Skip to content

Commit

Permalink
fix Tiles URL encoding in WMTS XML doc (#937)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago authored Jun 26, 2024
1 parent da7738d commit 3c73798
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 0.18.4 (2024-06-26)

* fix Tiles URL encoding for WMTSCapabilities XML document

## 0.18.3 (2024-05-20)

* fix `WMTSCapabilities.xml` response for ArcMap compatibility
Expand Down
16 changes: 16 additions & 0 deletions src/titiler/core/tests/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import pathlib
import warnings
import xml.etree.ElementTree as ET
from dataclasses import dataclass
from enum import Enum
from io import BytesIO
Expand Down Expand Up @@ -268,6 +269,19 @@ def test_TilerFactory():
meta = parse_img(response.content)
assert meta["driver"] == "WMTS"
assert meta["crs"] == "EPSG:3857"
root = ET.fromstring(response.content)
assert root

response = client.get(
f"/WebMercatorQuad/WMTSCapabilities.xml?url={DATA_DIR}/cog.tif&bdix=1&rescale=0,1000"
)
assert response.status_code == 200
assert response.headers["content-type"] == "application/xml"
meta = parse_img(response.content)
assert meta["driver"] == "WMTS"
assert meta["crs"] == "EPSG:3857"
root = ET.fromstring(response.content)
assert root

response = client.get(
f"/WorldCRS84Quad/WMTSCapabilities.xml?url={DATA_DIR}/cog.tif&minzoom=5&maxzoom=12"
Expand All @@ -277,6 +291,8 @@ def test_TilerFactory():
meta = parse_img(response.content)
assert meta["driver"] == "WMTS"
assert str(meta["crs"]) == "OGC:CRS84"
root = ET.fromstring(response.content)
assert root

response = client.get(f"/bounds?url={DATA_DIR}/cog.tif")
assert response.status_code == 200
Expand Down
2 changes: 1 addition & 1 deletion src/titiler/core/titiler/core/templates/wmts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<TileMatrixSetLink>
<TileMatrixSet>{{ tms.id }}</TileMatrixSet>
</TileMatrixSetLink>
<ResourceURL format="{{ media_type }}" resourceType="tile" template="{{ tiles_endpoint }}" />
<ResourceURL format="{{ media_type }}" resourceType="tile" template="{{ tiles_endpoint | escape }}" />
</Layer>
<TileMatrixSet>
<ows:Identifier>{{ tms.id }}</ows:Identifier>
Expand Down

0 comments on commit 3c73798

Please sign in to comment.