pygeoapi icon indicating copy to clipboard operation
pygeoapi copied to clipboard

Set begin/end datetime via admin api

Open totycro opened this issue 1 year ago • 0 comments

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

totycro avatar Apr 24 '24 07:04 totycro