iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.1k stars 300 forks source link

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

Closed murphysurveys closed 2 years ago

murphysurveys commented 4 years ago

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

zarov commented 4 years ago

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 commented 4 years ago

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.

murphysurveys commented 4 years ago

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?

zarov commented 4 years ago

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.

jailln commented 2 years ago

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