Skip to content

Commit

Permalink
add OGC API coverages datetime support
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Jan 16, 2025
1 parent baa3719 commit 1bed90a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions owslib/ogcapi/coverages.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def coverage(self, collection_id: str, **kwargs: dict) -> BinaryIO:
@param scale_factor: factor by which to scale the resulting coverage
@type scale_axes: list of tuples
@param scale_axes: [(axis name, number)]
@type datetime: tuple | str
@param datetime:
tuple of start/end datetimes or as 'start/end' string
start and end datetimes can be ".." for unbounded value
@returns: coverage data
"""
Expand Down Expand Up @@ -85,6 +89,12 @@ def coverage(self, collection_id: str, **kwargs: dict) -> BinaryIO:
if 'scale_factor' in kwargs:
kwargs_['scale-factor'] = int(kwargs['scale_factor'])

if "datetime" in kwargs:
if isinstance(kwargs['datetime'], tuple):
kwargs_['datetime'] = '/'.join(kwargs['datetime'][:2])
else:
kwargs_['datetime'] = str(kwargs['datetime'])

path = f'collections/{collection_id}/coverage'

return BytesIO(self._request(path=path, as_dict=False, kwargs=kwargs_))

0 comments on commit 1bed90a

Please sign in to comment.