Skip to content

Commit

Permalink
Fix CRS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed Nov 12, 2024
1 parent f7c789d commit 3bb56ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions xpublish_wms/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 5 additions & 2 deletions xpublish_wms/wms/get_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3bb56ae

Please sign in to comment.