fix: emit OGC-valid WMTS SupportedCRS urn (urn:ogc:def:crs:EPSG::4326) - #97
Merged
Merged
Conversation
…n prefix
MapProxy 6.0.0 changed the WMTS 1.0.0 capabilities template in two ways
that our WMTS clients reject (upstream commit b8f8949b, "restful encoding
/ style isdefault and urn:ogc:def:crs for SupportedCRS"):
1. <Style> gained an isDefault="true" attribute.
2. <ows:SupportedCRS> gained a "urn:ogc:def:crs:" prefix, so a grid on
EPSG:4326 advertises "urn:ogc:def:crs:EPSG:4326".
Add config/patch/wmts_capabilities_compat.py, applied in the builder stage
alongside the redis.py and s3.py patches and gated on the same PATCH_FILES
build arg, to restore the pre-6.0 output for exactly those two elements.
Unlike the other two patches this one rewrites the two lines in place
rather than shipping a full copy of the template. A full-file copy would
silently revert unrelated upstream template improvements on a MapProxy
bump; the in-place edit asserts an exact match and aborts the build if
upstream reworks those lines.
Verified by building the image with PATCH_FILES=true and =false and
rendering capabilities for a WorldCRS84 (EPSG:4326) and a webmercator
(EPSG:3857) grid over both the RESTful and KVP endpoints:
stock 6.0.1 -> <Style isDefault="true"> urn:ogc:def:crs:EPSG:4326
patched -> <Style> EPSG:4326
Output parses clean and the template diff against upstream is exactly the
two intended lines. Cross-checked against the pre-6 image still serving
tiles-dev, whose capabilities carry the bare <Style> and unprefixed CRS.
…tead of stripping the prefix Per OGC 07-092r1 the CRS urn carries an empty version field between authority and code, so the separator is a double colon. Stock MapProxy 6 renders urn:ogc:def:crs:EPSG:4326 (single colon — invalid). The patch now keeps the prefix and doubles the first colon of srs_name at render time instead of removing the prefix entirely. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
isDefault="true" is valid, spec-recommended WMTS 1.0.0 output; removing it was a pre-6 compat workaround, not a correctness fix. The patch now touches a single template line: the SupportedCRS urn version colon. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CL-SHLOMIKONCHA
approved these changes
Aug 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues: —
Further information
What changed upstream
MapProxy 6.0.0 — upstream commit
b8f8949b"restful encoding / style isdefault and urn:ogc:def:crs for SupportedCRS" (Jun 2025) — gave<ows:SupportedCRS>in the WMTS 1.0.0 capabilities template aurn:ogc:def:crs:prefix, rendered asurn:ogc:def:crs:EPSG:4326.That urn is invalid per OGC 07-092r1: a CRS urn is
urn:ogc:def:crs:<authority>:<version>:<code>, and with an empty version field the separator between authority and code must be a double colon (EPSG::4326). MapProxy templatesurn:ogc:def:crs:{{tile_matrix_set.srs_name}}wheresrs_nameis the plainEPSG:4326srs code — producing a single colon.<ows:SupportedCRS>urn:ogc:def:crs:EPSG:4326urn:ogc:def:crs:EPSG::4326This PR keeps the urn prefix and doubles the first colon of
srs_nameat render time ({{tile_matrix_set.srs_name.replace(':', '::', 1)}}), yielding the standard-conformant form for everyTileMatrixSet(EPSG::4326,EPSG::3857, …).The same upstream commit also added
isDefault="true"to<Style>. That attribute is valid, spec-recommended WMTS 1.0.0 output, so this PR deliberately leaves it in place.Approach
New patch
config/patch/wmts_capabilities_compat.py, applied in the builder stage next to the existingredis.py/s3.pypatches — same bind-mount (patch source never lands in an image layer), samePATCH_FILESgate, same abort-the-build-on-failure contract.Unlike the other two patches, this one rewrites the single line in place instead of shipping a full copy of the template. That's deliberate: a full-file copy would silently revert unrelated upstream template improvements on the next MapProxy bump, whereas the in-place edit asserts an exact match and fails the build loudly if upstream reworks the line. The patch also refuses to write if the original invalid form survives the rewrite.
Verification
isDefaultuntouched.SupportedCRSline through MapProxy's bundled Tempita engine:EPSG:4326→urn:ogc:def:crs:EPSG::4326,EPSG:3857→urn:ogc:def:crs:EPSG::3857.Out of scope: other differences from the same commit
The same upstream commit also added an
<ows:OperationsMetadata>block to the RESTful capabilities response (the pre-6 image emits 0 of those for RESTful; MapProxy 6 emits 1). As withisDefault, this PR does not touch it — only the invalid urn is corrected.