geopython / pygeoapi

pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
https://pygeoapi.io
MIT License
460 stars 250 forks source link

Set begin/end datetime via admin api #1638

Open totycro opened 2 months ago

totycro commented 2 months ago

Is your feature request related to a problem? Please describe. Not sure if this is actually a bug request: it doesn't seem to be possible to add or modify a collection with a begin or end datetime via the admin api.

The config uses datetime fields like this:

begin: 2000-10-30T18:24:39Z

Note that in yaml, this is not a string but a datetime.

However the admin api passes in data via json, and json does not have support for datetimes, so you can only pass in null or perhaps a string. But strings as datetimes are not supported by pygeopapi:

  File "/home/mallinger/git/pygeoapi-fork-totycro/venv/lib/python3.10/site-packages/pygeoapi-0.17.dev0-py3.10.egg/pygeoapi/api/__init__.py", line 969, in describe_collections
    begins = dategetter('begin', t_ext)
  File "/home/mallinger/git/pygeoapi-fork-totycro/venv/lib/python3.10/site-packages/pygeoapi-0.17.dev0-py3.10.egg/pygeoapi/util.py", line 132, in dategetter
    return value.isoformat()
AttributeError: 'str' object has no attribute 'isoformat'

Describe the solution you'd like A way to add or modify a collection which has a temporal extent. To achieve this, maybe the serialization format for the admin API needs to be changed to yaml (which is slower and could have security implications if done wrong)

Describe alternatives you've considered

Additional context