Skip to content
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

fix OGC API coverages subset and datetime not forwarded #967

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
fmigneault marked this conversation as resolved.
Show resolved Hide resolved
@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):
fmigneault marked this conversation as resolved.
Show resolved Hide resolved
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