Skip to content
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

WMS prototype working #572

Merged
merged 11 commits into from
Jan 26, 2023
Prev Previous commit
Next Next commit
add a test for empty CRS
  • Loading branch information
vincentsarago committed Jan 25, 2023
commit 58127348d2060fda0d35881b950071befce2be3e
17 changes: 17 additions & 0 deletions src/titiler/extensions/tests/test_wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,23 @@ def test_wmsExtension_GetMap():
assert meta["height"] == 333
assert meta["crs"] == CRS.from_epsg(32621)

response = client.get(
"/wms",
params={
"VERSION": "1.3.0",
"REQUEST": "GetMap",
"LAYERS": cog,
"BBOX": "373185.0,8019284.949381611,639014.9492102272,8286015.0",
"CRS": "",
"WIDTH": 334,
"HEIGHT": 333,
"FORMAT": "image/png",
"TRANSPARENT": True,
},
)
assert response.status_code == 400
assert "Invalid 'CRS' parameter" in response.text

response = client.get(
"/wms",
params={
Expand Down
8 changes: 7 additions & 1 deletion src/titiler/extensions/titiler/extensions/wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,13 @@ def wms(
status_code=400, detail="Missing 'CRS' or 'SRS parameters."
)

crs = CRS.from_user_input(req.get("crs", req.get("srs")))
crs_value = req.get("crs", req.get("srs"))
if not crs_value:
raise HTTPException(
status_code=400, detail="Invalid 'CRS' parameter."
)

crs = CRS.from_user_input(crs_value)

bbox = list(map(float, req["bbox"].split(",")))
if len(bbox) != 4:
Expand Down