Skip to content

bbox-crs parameter mishandled in OAMaps #1995

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

Open
webb-ben opened this issue Apr 16, 2025 · 0 comments · May be fixed by #1999
Open

bbox-crs parameter mishandled in OAMaps #1995

webb-ben opened this issue Apr 16, 2025 · 0 comments · May be fixed by #1999
Labels
bug Something isn't working OGC API - Maps OGC API - Maps

Comments

@webb-ben
Copy link
Member

webb-ben commented Apr 16, 2025

Description
The bbox-crs parameter is improperly conflates crs and bbox-crs

query_args['crs'] = request.params.get('bbox-crs', 4326)
resulting in errors during CRS conversion. This is different than the behavior when compared to OAFeat/OARec
if len(bbox) > 0:
try:
# Get a pyproj CRS instance for the Collection's Storage CRS
storage_crs = provider_def.get('storage_crs', DEFAULT_STORAGE_CRS) # noqa
# Do the (optional) Transform to the Storage CRS
bbox = transform_bbox(bbox, bbox_crs, storage_crs)
except CRSError as e:
return api.get_exception(
HTTPStatus.BAD_REQUEST, headers, request.format,
'NoApplicableCode', str(e))

Steps to Reproduce

Expected behavior
pygeoapi is able to appropriately convert bbox CRS without while fulfilling the requirements of https://docs.ogc.org/is/20-058/20-058.html#req_spatial-subsetting_bbox-crs

Screenshots/Tracebacks
The error happens because bbox-crs controls the CRS used for the subquery, not the CRS of the bbox provided in the request. This can be seen in the request made to the WMS

lib/python3.12/site-packages/urllib3/connectionpool.py:475} DEBUG - https://mapservices.weather.noaa.gov:443 "GET /raster/services/snow/NOHRSC_Snow_Analysis/MapServer/WMSServer?version=1.1.0&service=WMS&request=GetMap&bbox=inf%2Cinf%2Cinf%2Cinf&srs=EPSG%3A3857&layers=1&styles=default&width=500&height=300&format=image%2Fpng&transparent=TRUE HTTP/1.1" 200 159
INFO:     127.0.0.1:56373 - "GET /collections/nohrsc-swe/map?bbox=-15328796.3079,2554678.3593,-5828590.9363,8415258.1920&bbox-crs=http://www.opengis.net/def/crs/EPSG/0/3857 HTTP/1.1" 200 OK

The WMSFacade provider always converts the input bbox CRS from 4269 to whatever bbox-crs is:

src_crs = pyproj.CRS.from_string('epsg:4326')
dest_crs = pyproj.CRS.from_string(CRS_CODES[crs])
transformer = pyproj.Transformer.from_crs(src_crs, dest_crs,
always_xy=True)

Environment

  • OS: All
  • Python version: 0.21.dev0
  • pygeoapi version: 3.10+

Additional context
Add any other context about the problem here.

@webb-ben webb-ben added bug Something isn't working OGC API - Maps OGC API - Maps labels Apr 16, 2025
@C-Loftus C-Loftus linked a pull request Apr 22, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working OGC API - Maps OGC API - Maps
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant