Skip to content

fix OGC API coverages subset and datetime not forwarded #967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 21, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion 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 All @@ -80,11 +84,17 @@ def coverage(self, collection_id: str, **kwargs: dict) -> BinaryIO:
subsets_list = []
for s in kwargs['subset']:
subsets_list.append(f'{s[0]}({s[1]}:{s[2]})')
kwargs['subset'] = ','.join(subsets_list)
kwargs_['subset'] = ','.join(subsets_list)

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_))
Loading