Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VectorTile layers with source minZoom 0 not visible when view is zoomed out #994

Closed
mike-000 opened this issue Oct 1, 2023 · 1 comment · Fixed by #1121
Closed

VectorTile layers with source minZoom 0 not visible when view is zoomed out #994

mike-000 opened this issue Oct 1, 2023 · 1 comment · Fixed by #1121

Comments

@mike-000
Copy link
Contributor

mike-000 commented Oct 1, 2023

Open https://openlayers.org/en/v6.14.1/examples/vector-tiles-4326.html in a window with width 1024px or less, the layer is visible.

Repeat with https://openlayers.org/en/latest/examples/vector-tiles-4326.html the layer is not visible until the view is zoomed in to just beyond level 2.

The same problem can be seen in https://openlayers.org/en/latest/examples/mapbox-vector-layer.html if zooming out to level 1 or less in a smaller (512px or less) window.

This was introduced by #520 (and later moved to apply.js), however there was already code which takes care not to set a maxResolution on layers if the source minZoom is 0 https://github.com/openlayers/ol-mapbox-style/blob/main/src/apply.js#L1206 while the new code simply sets maxResolution regardless https://github.com/openlayers/ol-mapbox-style/blob/main/src/apply.js#L315

For comparison MapLibre has no problem displaying layers at resolutions beyond that of OpenLayers view zoom 0
image
(which instead of a multiWorld constraint uses the equivalent of an OpenLayers [-Infinity, minY, +Infinity, maxY] extent constraint).

@mike-000
Copy link
Contributor Author

mike-000 commented Oct 2, 2023

In both the examples adding minZoom: 0 to the layer options prevents the maxResolution being set inappropriately, but it would be better to fix this at the cause.

While this issue is specific to applyStyle and MapboxVectorLayer the code in finalizeLayer from which any fix would be based looks out of date as it should now be able to handle non-standard projections but always uses defaultResolutions. Should that now be options.resolutions || defaultResolutions (with the hardcoded 24 changed to match that length)? And when units are degrees simply adding 1e-9 to a resolution might not give a good result, multiplying by (1 + 1e-9) might be more appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant