From 00a2283b3e6e868d450d1d4926a89b614a43dc71 Mon Sep 17 00:00:00 2001 From: Tom Kazimiers Date: Fri, 18 Sep 2026 09:41:18 +0200 Subject: [PATCH] Make WebMercatorQuad use (X,Y) coordinate order (like OGC) The official OGC tile matrix set for WebMercatorQuad uses `(X, Y)` order, as can be seen by lines like this: "pointOfOrigin": [-20037508.3427892,20037508.3427892]) in the JSON definition found here: https://github.com/opengeospatial/2D-Tile-Matrix-Set/blob/master/registry/json/WebMercatorQuad.json Therefore, the GWC definition for this grid set should also follow this coordinate order. So far, GWC defined WebMercatorQuad with `yCoordinateFirst=true`, causing the `(Y, X)` coordinate order. As a consequence, the top left corner in the GetCapabilties XML looks like this for WebMercatorQuad: (2.003750834E7 -2.003750834E) This is only the top left corner, if `(Y, X)` is assumed. Other tools don't do this, they assume `(X, Y)` for WebMercatorQuad. For instance, this causes issues when loading a WebMercatorQuad tile matrix set with GDAL, as shown in issue OSGeo/gdal#15248, making it impossible to load data. --- .../src/main/java/org/geowebcache/config/DefaultGridsets.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geowebcache/core/src/main/java/org/geowebcache/config/DefaultGridsets.java b/geowebcache/core/src/main/java/org/geowebcache/config/DefaultGridsets.java index ab4c7366a8..16043cafe7 100644 --- a/geowebcache/core/src/main/java/org/geowebcache/config/DefaultGridsets.java +++ b/geowebcache/core/src/main/java/org/geowebcache/config/DefaultGridsets.java @@ -278,7 +278,7 @@ public DefaultGridsets(boolean useEPSG900913, boolean useGWC11xNames) { }, 256, 256, - true); + false); // copied from the OGC TMS spec WEB_MERCATOR_QUAD.setDescription( "This tile matrix set is the most used tile matrix set in the mass market: for example, by Google Maps, Microsoft Bing Maps and Open Street Map tiles. Nevertheless, it has been long criticized because it is a based on a spherical Mercator instead of an ellipsoid. The use of WebMercatorQuad should be limited to visualization. Any additional use (including distance measurements, routing etc.) needs to use the Mercator spherical expressions to transform the coordinate to an appropriate CRS first. The risks caused by imprecision in the use of Web Mercator is also emphasized by the US National Geospatial Agency (NGA). NGA has issued an Advisory Notice on web Mercator (http://earth-info.nga.mil/GandG/wgs84/web_mercator/index.html) that says that “it may cause geo-location / geo-coordinate errors up to 40,000 meters. This erroneous geospatial positioning information poses an unacceptable risk to global safety of navigation activities, and department of defense, intelligence community, and allied partner systems, missions, and operations that require accurate and precise positioning and navigation information.” The use of WorldMercatorWGS84Quad is recommended.");