Skip to content

fix: emit OGC-valid WMTS SupportedCRS urn (urn:ogc:def:crs:EPSG::4326) - #97

Merged
CL-SHLOMIKONCHA merged 3 commits into
masterfrom
fix/wmts-capabilities-pre6-compat
Aug 23, 2026
Merged

fix: emit OGC-valid WMTS SupportedCRS urn (urn:ogc:def:crs:EPSG::4326)#97
CL-SHLOMIKONCHA merged 3 commits into
masterfrom
fix/wmts-capabilities-pre6-compat

Conversation

@razbroc

@razbroc razbroc commented Aug 20, 2026

Copy link
Copy Markdown
Contributor
Question Answer
Bug fix
New feature
Breaking change
Deprecations
Documentation
Tests added
Chore

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 a urn:ogc:def:crs: prefix, rendered as urn: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 templates urn:ogc:def:crs:{{tile_matrix_set.srs_name}} where srs_name is the plain EPSG:4326 srs code — producing a single colon.

Element MapProxy 6.x (stock) This PR
<ows:SupportedCRS> urn:ogc:def:crs:EPSG:4326 urn:ogc:def:crs:EPSG::4326

This PR keeps the urn prefix and doubles the first colon of srs_name at render time ({{tile_matrix_set.srs_name.replace(':', '::', 1)}}), yielding the standard-conformant form for every TileMatrixSet (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 existing redis.py / s3.py patches — same bind-mount (patch source never lands in an image layer), same PATCH_FILES gate, 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

  • Applied the patch to the pristine upstream 6.0.1 template: the diff is exactly the one intended line — nothing else touched, isDefault untouched.
  • Rendered the patched SupportedCRS line through MapProxy's bundled Tempita engine: EPSG:4326urn:ogc:def:crs:EPSG::4326, EPSG:3857urn:ogc:def:crs:EPSG::3857.
  • Failure modes confirmed: re-running on an already-patched file, or on a template where the line was reworded, aborts with a clear message instead of silently no-op'ing.

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 with isDefault, this PR does not touch it — only the invalid urn is corrected.

razbroc and others added 2 commits August 20, 2026 15:31
…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>
@CL-SHLOMIKONCHA CL-SHLOMIKONCHA changed the title fix: revert WMTS capabilities isDefault attribute and SupportedCRS urn prefix fix: WMTS capabilities — drop Style isDefault, emit OGC-valid SupportedCRS urn Aug 23, 2026
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 CL-SHLOMIKONCHA changed the title fix: WMTS capabilities — drop Style isDefault, emit OGC-valid SupportedCRS urn fix: emit OGC-valid WMTS SupportedCRS urn (urn:ogc:def:crs:EPSG::4326) Aug 23, 2026
@CL-SHLOMIKONCHA
CL-SHLOMIKONCHA merged commit f94addc into master Aug 23, 2026
5 checks passed
@CL-SHLOMIKONCHA
CL-SHLOMIKONCHA deleted the fix/wmts-capabilities-pre6-compat branch August 23, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants