From 3bb56ae94320e5cec81b1d2f75b62e95768bd81a Mon Sep 17 00:00:00 2001 From: Matthew Iannucci Date: Tue, 12 Nov 2024 15:41:35 -0500 Subject: [PATCH] Fix CRS issues --- xpublish_wms/query.py | 4 ++-- xpublish_wms/wms/get_map.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xpublish_wms/query.py b/xpublish_wms/query.py index 9d86d32..e2270a9 100644 --- a/xpublish_wms/query.py +++ b/xpublish_wms/query.py @@ -206,8 +206,8 @@ def wms_query( "EPSG:4326", description="Coordinate reference system to use for the query. EPSG:4326 and EPSG:3857 are supported for this request", ), - srs: Literal["EPSG:4326", "EPSG:3857"] = Query( - "EPSG:4326", + srs: Optional[Literal["EPSG:4326", "EPSG:3857"]] = Query( + None, description="Coordinate reference system to use for the query. EPSG:4326 and EPSG:3857 are supported for this request", ), time: Optional[str] = Query( diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index 5b3ffc1..74f3f05 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -149,6 +149,7 @@ def ensure_query_types( if tile is not None: tile = [float(x) for x in query.tile.split(",")] self.bbox = mercantile.xy_bounds(*tile) + self.crs = "EPSG:3857" # tiles are always mercator else: self.bbox = [float(x) for x in query.bbox.split(",")] self.width = query.width @@ -301,8 +302,8 @@ def render( # than we need da = filter_data_within_bbox(da, self.bbox, diff) except Exception as e: - print(f"Error filtering data within bbox: {e}") - print("Falling back to full layer") + logger.error(f"Error filtering data within bbox: {e}") + logger.warning("Falling back to full layer") # Squeeze single value dimensions da = da.squeeze() @@ -343,6 +344,8 @@ def render( y_range=(self.bbox[1], self.bbox[3]), ) + print(da) + if ds.gridded.render_method == RenderMethod.Quad: mesh = cvs.quadmesh( da,