itowns
itowns copied to clipboard
[BUG] Difference in representation of MVT between iTowns and OpenLayer
It seems that iTowns is requesting one zoom level above openlayer.
Context
When we synchronize an OpenLayer view with an Itowns view, we can see that, for the same extent, we have 2 differents representations.
Steps to Reproduce (for bugs)
Open a view in openLayer with a MVT feed such as https://data.geopf.fr/annexes/ressources/vectorTiles/styles/PLAN.IGN/standard.json
Expected Behavior
Having the same details/representation in both engine
Actual Behavior
Possible Cause/Fix/Solution
From https://wiki.openstreetmap.org/wiki/Zoom_levels, at the end:
Mapbox GL based libraries uses 512×512-pixel tiles by default, so Mapbox GL zoom levels are one fewer than the zoom levels described above that are used by other tools.
it sounds a lot like the issue described here
The vector tiles from IGN's PLAN.IGN
is distributed as a TMS, so both openlayers
and itowns
should have the same tiles for a given zoom level. I think your issue is caused by the fact that itowns
subdivides the terrain before openlayers
.
The subdivision threshold should be configurable in both GlobeView
(resp PlanarView
) or directly in GlobeLayer
(resp. PlanarLayer
). It could maybe be not exposed or documented for the end-user...
However if you decide to delay the subvision of the tile, your data may appear blurry at the default resolution of 256x256 pixels. It seems however that this resolution is hardcoded in itowns
but IHMO it should set as a parameter of the Layer
.
N.B. It seems that FeatureToTexture
has a parameter to control the texture size however it is called with the value 256
: https://github.com/iTowns/itowns/blob/2fb3298f07a07cc1b7fb98025479da29f6f51557/src/Converter/textureConverter.js#L31
It looks like I need to change in 3 places : https://github.com/iTowns/itowns/blob/2fb3298f07a07cc1b7fb98025479da29f6f51557/src/Converter/textureConverter.js#L31 https://github.com/iTowns/itowns/blob/2fb3298f07a07cc1b7fb98025479da29f6f51557/src/Provider/Fetcher.js#L4 Edit not the fetcher, it seems that its not used in the case of MVT https://github.com/iTowns/itowns/blob/2fb3298f07a07cc1b7fb98025479da29f6f51557/src/Process/LayeredMaterialNodeProcessing.js#L5