Skip to content

Commit 183caac

Browse files
authored
Support EDR single item locations for Starlette (geopython#1827)
* Support EDR single item locations for starlette * Model behavior after flask app handler
1 parent a3b42ba commit 183caac

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pygeoapi/starlette_app.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,12 +511,13 @@ async def get_job_result_resource(request: Request,
511511
api_.get_job_result_resource, request, job_id, resource)
512512

513513

514-
async def get_collection_edr_query(request: Request, collection_id=None, instance_id=None): # noqa
514+
async def get_collection_edr_query(request: Request, collection_id=None, instance_id=None, location_id=None): # noqa
515515
"""
516516
OGC EDR API endpoints
517517
518518
:param collection_id: collection identifier
519519
:param instance_id: instance identifier
520+
:param location_id: location id of a /locations/<location_id> query
520521
521522
:returns: HTTP response
522523
"""
@@ -527,10 +528,15 @@ async def get_collection_edr_query(request: Request, collection_id=None, instanc
527528
if 'instance_id' in request.path_params:
528529
instance_id = request.path_params['instance_id']
529530

530-
query_type = request["path"].split('/')[-1] # noqa
531+
if 'location_id' in request.path_params:
532+
location_id = request.path_params['location_id']
533+
query_type = 'locations'
534+
else:
535+
query_type = request['path'].split('/')[-1]
536+
531537
return await execute_from_starlette(
532538
edr_api.get_collection_edr_query, request, collection_id,
533-
instance_id, query_type,
539+
instance_id, query_type, location_id,
534540
skip_valid_check=True,
535541
)
536542

0 commit comments

Comments
 (0)