Skip to content
Merged
Changes from all 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
23 changes: 15 additions & 8 deletions pygeoapi/api/itemtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,21 @@ def get_collection_items(
'href': f'{uri}?f={F_HTML}{serialized_query_params}'
}])

if offset > 0:
next_link = False
prev_link = False

if 'next' in [link['rel'] for link in content['links']]:
LOGGER.debug('Using next link from provider')
else:
if content.get('numberMatched', -1) > (limit + offset):
next_link = True
elif len(content['features']) == limit:
next_link = True

if offset > 0:
prev_link = True

if prev_link:
prev = max(0, offset - limit)
content['links'].append(
{
Expand All @@ -555,13 +569,6 @@ def get_collection_items(
'href': f'{uri}?offset={prev}{serialized_query_params}'
})

next_link = False

if content.get('numberMatched', -1) > (limit + offset):
next_link = True
elif len(content['features']) == limit:
next_link = True

if next_link:
next_ = offset + limit
next_href = f'{uri}?offset={next_}{serialized_query_params}'
Expand Down