From 88ffc559ccc4bf5ff17f2f1f8f453aaf550fd29c Mon Sep 17 00:00:00 2001 From: Niels Meijer Date: Wed, 29 Apr 2020 13:50:08 +0200 Subject: [PATCH] Change XY based on projection.getAxisOrientation(), not only for EPSG:4326 --- src/ol/source/WMTS.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ol/source/WMTS.js b/src/ol/source/WMTS.js index e938f77d08..5a98758886 100644 --- a/src/ol/source/WMTS.js +++ b/src/ol/source/WMTS.js @@ -449,14 +449,14 @@ export function optionsFromCapabilities(wmtsCap, config) { } const wrapX = false; + const switchOriginXY = projection.getAxisOrientation().substr(0, 2) == 'ne'; const matrix0 = matrixSetObj.TileMatrix[0]; const resolution = (matrix0.ScaleDenominator * 0.00028) / projection.getMetersPerUnit(); // WMTS 1.0.0: standardized rendering pixel size - const origin = - projection === getProjection('EPSG:4326') - ? [matrix0.TopLeftCorner[1], matrix0.TopLeftCorner[0]] - : matrix0.TopLeftCorner; + const origin = switchOriginXY + ? [matrix0.TopLeftCorner[1], matrix0.TopLeftCorner[0]] + : matrix0.TopLeftCorner; const tileSpanX = matrix0.TileWidth * resolution; const tileSpanY = matrix0.TileHeight * resolution;