Modify

Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#16084 closed defect (fixed)

WMTS does not support different tile sizes for layers using the same projection

Reported by: StefanB Owned by: team
Priority: normal Milestone: 18.03
Component: Core imagery Version:
Keywords: projection slovenia wmts Cc:

Description (last modified by StefanB)

In imagery for Slovenia we have a reference to WMTS service:
https://josm.openstreetmap.de/wiki/Maps/Slovenia#GURS:DTK5wmts
Which fetches capabilities from
http://prostor4.gov.si/ows2-gwc-pub/service/wmts?request=getCapabilities

Some of the layers there are in an older national projection EPSG:3912 (https://epsg.io/3912 = D48/GK), and those layers are not positioned correctly in JOSM (eg in lower zoom it is shifter 100km to the north). This old projection is being phased out, but some legacy data is still in it.

The layers in newer projection EPSG:3794 (https://epsg.io/3794 = D96/TM) are positioned much better

Whenever needed and possible, we use http://geocoordinateconverter.tk/ to convert data from the old projection to ETRS89 accurately, but int this case the layers are served via wmts service, giving us no influence.

Either

  • EPSG:3912 projection should be better supported (probably not easy) to position the layer better or
  • disable such layer selection in the "Select WMTS layer" dialog window
  • add some additional warning that layer might not work at all

Current "Select WMTS layer" dialog:
https://i.imgur.com/D3TWN0d.png

Attachments (1)

Screen Shot 2018-03-18 at 12.42.28.png (400.3 KB) - added by StefanB 14 months ago.
Misplaced rendering

Download all attachments as: .zip

Change History (16)

comment:1 Changed 14 months ago by StefanB

Description: modified (diff)

comment:2 Changed 14 months ago by StefanB

Description: modified (diff)

comment:3 Changed 14 months ago by StefanB

Description: modified (diff)

comment:4 Changed 14 months ago by Klumbumbus

and those layers are not positioned correctly in JOSM (eg in lower zoom it is shifter 100km to the north)

  • At which zoom?
  • At which position?
  • What did you set as projection in JOSM?
  • JOSM automatically reprojects, but using the "native" projection of the tiles might be better. At a quick test with JOSM reprojecting DTK5 EPSG:3912 to mercator I couldn't find misplaced tiles.

comment:5 Changed 14 months ago by Don-vip

Keywords: projection slovenia added

comment:6 Changed 14 months ago by Don-vip

Owner: changed from team to StefanB
Status: newneedinfo

I tried too and it seems to work fine (offset between Bing and DTK5 EPSG:3912 less than 5m).

Changed 14 months ago by StefanB

Misplaced rendering

comment:7 Changed 14 months ago by StefanB

Indeed, most of the problems encountered were with the layers starting with "table_gurs_pub...", eg the table_gurs_pub:SI.GURS.RPE.NA (Naselja, settlements) layer loads image:
http://prostor4.gov.si/ows2-gwc-pub/service/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=table_gurs_pub:SI.GURS.RPE.NA&STYLE=&FORMAT=image/png&tileMatrixSet=EPSG:3912_ALL_SCALES_512pxl&tileMatrix=EPSG:3912_ALL_SCALES_512pxl:5&tileRow=4&tileCol=4
which is 512x512 px (got hint from the matrix set name, but confirmed in the actual image), which might screw up the positioning, which then renders badly:
Misplaced rendering
(cyan is the "GURS: Road lines" layer, which matches very well to OSM data; violet is the table_gurs_pub:SI.GURS.RPE.NA layer)

Last edited 14 months ago by StefanB (previous) (diff)

comment:8 Changed 14 months ago by stoecker

Owner: changed from StefanB to team
Status: needinfonew

Hmm, maybe for WMTS we need to auto-detect the size, as we can't provide it in the XML...

comment:9 in reply to:  8 Changed 14 months ago by Don-vip

Replying to stoecker:

Hmm, maybe for WMTS we need to auto-detect the size, as we can't provide it in the XML...

It's provided in the capabilities:

            <TileMatrix>
                <ows:Identifier>EPSG:3912_ALL_SCALES_512pxl:0</ows:Identifier>
                <ScaleDenominator>1250000.0</ScaleDenominator>
                <TopLeftCorner>370210.0 200055.0</TopLeftCorner>
                <TileWidth>512</TileWidth>
                <TileHeight>512</TileHeight>
                <MatrixWidth>2</MatrixWidth>
                <MatrixHeight>1</MatrixHeight>
            </TileMatrix>

comment:10 Changed 14 months ago by Don-vip

Bug is in WMTSTileSource:

        if (tileProjection != null) {
            // no support for non-square tiles (tileHeight != tileWidth)
            // and for different tile sizes at different zoom levels
            Collection<Layer> projLayers = getLayers(null, tileProjection.toCode());
            if (!projLayers.isEmpty()) {
                cachedTileSize = projLayers.iterator().next().tileMatrixSet.tileMatrix.get(0).tileHeight;
                return cachedTileSize;
            }
        }

We rely only on projection, and use the tile dimensions of the first layer matching the current projection, instead of using the actual size defined for the current tile matrix.

comment:11 Changed 14 months ago by Don-vip

Keywords: wmts added
Milestone: 18.03
Summary: WMTS allows adding imagery with unsupported projectionsWMTS does not support different tile sizes for layers using the same projection

comment:12 Changed 14 months ago by Don-vip

Resolution: fixed
Status: newclosed

In 13539/josm:

fix #16084 - WMTS: support different tile sizes for layers using the same projection

comment:13 Changed 14 months ago by StefanB

Wonderful!
I will try it as soon as the josm-latest.jar with this fix (version 13539 or higher) is available.
Thank you!!!

comment:14 Changed 14 months ago by Don-vip

In 13542/josm:

see #16084 - remove unused code

comment:15 Changed 14 months ago by StefanB

Tested version 13544, and layers seem to be rendered perfectly!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.