Print: Determine topLeft axis order by supportedCRS of TileMatrixSet #920
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.
Currently the axis order of topLeft is assumed to always be x,y (it's even returned to oskari-frontend as
{"lon": [0], "lat": [1]}
byGetLayerCapabilities
action) but WMTS spec states thatThe order of these axes, shall be as specified by the supportedCRS
. This leads to wrong tileRow/tileCol calculations in service-print.For frontend OL does the swapping for us:
https://github.com/oskariorg/oskari-frontend/blob/2.9.1/bundles/mapping/mapwmts/service/WmtsLayerService.ol.js#L189
https://github.com/openlayers/openlayers/blob/v7.0.0/src/ol/source/WMTS.js#L455
https://github.com/openlayers/openlayers/blob/v7.0.0/src/ol/source/WMTS.js#L484-L486
so fixing this "more deeply" would cause issues.
Obviously messing with axis order is always risky for backwards compatibility. However, printouts should reflect what's shown on users screen, so print service mimicking what OL is doing seems like the way to go.
Here's a sample printout from Oskari installation with the fix applied running EPSG:3879 (GK25FIN, NE axis order) with WMTS (aerial image, in EPSG:3879 tilematrixset) + WMS (red boundary) + feature layer (yellowish semi-transparent rectangles) .