itowns icon indicating copy to clipboard operation
itowns copied to clipboard

Is there an issue in rendering incomplete TMS tilesets? i.e. limited zoom range between limited lat/ long

Open murphysurveys opened this issue 5 years ago • 4 comments

Is there an issue in rendering incomplete TMS tilesets? i.e. limited zoom range between limited lat/ long

I have a small demo using a geo-referenced image of an area of Dublin converted to TMS tiles using GDAL 2 Tiles.

The demo contains both the JSON file and direct methods for creating a new TMS colour layer.

Despite not throwing a relevant error, the layer does not render. I'm wondering if iTowns is has a bug in rendering a colour layer which only covers a portion of the globe. Or perhaps I'm missing something obvious.

Your Environment

iTowns version 2.24

live version here: http://128.199.43.119/itowns/TMS_test.html

Expected Behavior

Expect the TMS tiles to render in the area around Dublin between zoom levels 5-21

Actual Behavior

not showing up, not throwing an error for that area between zoom 5-21

murphysurveys avatar Sep 10 '20 17:09 murphysurveys

Yes there is ! It isn't present in the documentation, but you can use tileMatrixSetLimits in your configuration, like this for example:

const tmsSource = new itowns.TMSSource({
   format: 'image/png',
   url: 'OSI_TMS_tiles/${z}/${x}/${y}.png',
   attribution: {
       name: 'OSI1',
       url: 'http://www.openstreetmap.org/',
   },
   tileMatrixSet: 'PM',
   projection: 'EPSG:3857',
   zoom: { min: 5, max: 21},
   tileMatrixSetLimits: {
       0: {
           minTileRow: 0,
           maxTileRow: 0,
           minTileCol: 0,
           maxTileCol: 1
       },
       1: {
           minTileRow: 0,
           maxTileRow: 1,
           minTileCol: 0,
           maxTileCol: 3
       },
       2: {
           minTileRow: 0,
           maxTileRow: 3,
           minTileCol: 0,
           maxTileCol: 7
       },
       3: {
           minTileRow: 0,
           maxTileRow: 7,
           minTileCol: 0,
           maxTileCol: 15
       },
       4: {
           minTileRow: 0,
           maxTileRow: 15,
           minTileCol: 0,
           maxTileCol: 31
       }
   },
});

zarov avatar Sep 10 '20 18:09 zarov

Sorry I misunderstood your question: you can specify the limitations using what I wrote above. This should solve you problem, but I am not really sure if you don't have "squared" levels.

zarov avatar Sep 10 '20 18:09 zarov

I added the extents limitation to the demo http://128.199.43.119/itowns/TMS_test.html, but the TMS still won't show up. By squared level do you mean that the tiles aren't aligned to the usual TMS divisions?

murphysurveys avatar Sep 10 '20 20:09 murphysurveys

the TMS still won't show up

After some investigation, it is a problem on our side, we don't manage correctly the inversion of the pyramid (the tms: true parameter you are setting when using leaflet for example). We'll try to fix that, thanks for bringing it up !

By squared level do you mean that the tiles aren't aligned to the usual TMS divisions?

Bad explanation, sorry: I mean if you define the level 5 with row going to 0 to 10, and column similar, it will fetch all tiles. If you don't have the corner tiles, because the city is basically a circle, if will throw fetching errors. That won't block itowns from running though.

zarov avatar Sep 11 '20 12:09 zarov

There is a parameter in TMSSource to specify if the pyramid is inverted, see here

jailln avatar Oct 14 '22 09:10 jailln