Skip to content

Conversation

@matzf
Copy link
Contributor

@matzf matzf commented Jan 23, 2026

Reorganize implementation of layer configs. Combine redundant implementation of default (webmercator), WebMercator again and Epsg4326 cases.

For the EPSG 3857 / WebMercator tile pyramid we now consistently use the base zoom value 559082264.029 instead of 500000000. Previously, both values where used in different places.
(Note: the webmercator tile pyramid is specified as urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible in OGC WMTS Simple Profile, with the used base zoom value as ScaleDenominator of TileMatrix 0.)

For raster sources, enabling EPSG:4326 was already supported before.
Now also support EPSG:2056 and EPSG:21871.
Support specifying in field "crs" in addition to previously supported "metadata"."crs".

@matzf matzf requested a review from maerki January 23, 2026 10:45
@matzf matzf force-pushed the feature/vectorlayer-source-crs branch from ae41717 to 165f65e Compare January 23, 2026 10:49
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae41717fa4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


Tiled2dMapZoomLevelInfo prevZoom = zoomLevelInfos.back();

for (auto it = zoomLevelInfos.rbegin() + maxZoomLevel; it != zoomLevelInfos.rend() + minZoomLevel; ++it) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Correct reverse-iterator bounds in zoom mapping

In the irregular zoom mapping path (used by EPSG:2056/21781), the loop starts at rbegin() + maxZoomLevel and ends at rend() + minZoomLevel. For the common case where levels is [0..N], that range only visits the first element (or an otherwise incorrect subset), so getZoomIdentifier ends up interpolating between the last and first zoom levels instead of the adjacent levels around zoom. This produces incorrect zoom identifiers and therefore wrong tile selection for any intermediate zoom.

Useful? React with 👍 / 👎.


Tiled2dMapZoomLevelInfo prevZoom = zoomLevelInfos.back();

for (auto it = zoomLevelInfos.begin() + minZoomLevel; it != zoomLevelInfos.end() + maxZoomLevel; ++it) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fix out-of-bounds iteration in zoom factor lookup

The loop terminator uses zoomLevelInfos.end() + maxZoomLevel, which advances past the end of the vector and causes the loop to compare and dereference iterators that are out of range. For irregular CRS sources, any call to getZoomFactorAtIdentifier that requires interpolation can walk into invalid memory, leading to undefined behavior or crashes when rendering EPSG:2056/21781 layers.

Useful? React with 👍 / 👎.

Reorganize implementation of layer configs. Combine redundant
implementation of default (webmercator), WebMercator again and Epsg4326
cases.

For raster sources, enabling EPSG:4326 was already supported before.
Now also support EPSG:2056 and EPSG:21871.
Support specifying in field "crs" in addition to previously supported
"metadata"."crs".
@matzf matzf force-pushed the feature/vectorlayer-source-crs branch from 165f65e to a1c4dc3 Compare January 23, 2026 16:33
For the EPSG 3857 / WebMercator tile pyramid we now consistently use
the base zoom value 559082264.029 instead of 500000000.0.
Previously. both values where used in different places.

Note: the webmercator tile pyramid is specified as
urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible in OGC WMTS Simple
Profile, with the used base zoom value as ScaleDenominator of TileMatrix 0.
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