-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
Fixing tiles resolutions #4627
Merged
Merged
Fixing tiles resolutions #4627
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rldhont
added
map viewer
javascript
Pull requests that update Javascript code
run end2end
If the PR must run end2end tests or not
backport release_3_7
backport release_3_8
labels
Jul 16, 2024
fixes 3liz#4332 Currently, if the map allows you to go beyond the min/zoom resolution of a WMTS or XYZ source, Lizmap won't display anything beyond this min/zoom resolution. OpenLayers is able to do resampling. This can be seen when you zoom in progressively. OpenLayers must be forced to use the max zoom of the grid even when the user goes beyond it. The solution is described on stackoverflow https://stackoverflow.com/questions/43538345/how-to-force-load-tiles-for-lower-resolution and is based on `TileGrid`'s `getZForResolution` method https://github.com/openlayers/openlayers/blob/main/src/ol/tilegrid/TileGrid.js#L634 ```js getZForResolution(resolution, opt_direction) { const z = linearFindNearest( this.resolutions_, resolution, opt_direction || 0, ); return clamp(z, this.minZoom, this.maxZoom); } ``` This method is based on the `this.resolutions_` list of grid resolutions. The index of the resolution closest to that in parameter is then set to the min or max zoom value. So if `this.resolutions_` contains 24 values but maxZoom is 19, then when the map is at levels 20, 21, 22, 23 and 24, the grid will limit queries to zoom 19. Funded by FM Projet
Generic method to build scales based on options config.
rldhont
force-pushed
the
fix-tiles-resolutions
branch
from
July 16, 2024 18:17
0de8798
to
3f5ae41
Compare
rldhont
force-pushed
the
fix-tiles-resolutions
branch
from
July 16, 2024 19:47
3f5ae41
to
30e65c6
Compare
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release_3_7 release_3_7
# Navigate to the new working tree
cd .worktrees/backport-release_3_7
# Create a new branch
git switch --create backport-4627-to-release_3_7
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick db21ff0da4b461a77d48f6a34961fc8c5976dedc,f2b6acb07a94a325785f02d150d4e429786d1064,9c0fa34da4589f744a87f7c09947c22bba7ffd69,0a7cd196f9276036d30f6681e8fd570c6de6e38d,30e65c63713b8cc4dfa9c3db47736eaa36943c38
# Push it to GitHub
git push --set-upstream origin backport-4627-to-release_3_7
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release_3_7 Then, create a pull request where the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport release_3_7
backport release_3_8
failed backport
javascript
Pull requests that update Javascript code
map viewer
run end2end
If the PR must run end2end tests or not
sponsored development
This development has been funded
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #4332
Currently, if the map allows you to go beyond the min/zoom resolution of a WMTS or XYZ source, Lizmap won't display anything beyond this min/zoom resolution.
OpenLayers is able to do resampling. This can be seen when you zoom in progressively. OpenLayers must be forced to use the max zoom of the grid even when the user goes beyond it.
The solution is described on stackoverflow https://stackoverflow.com/questions/43538345/how-to-force-load-tiles-for-lower-resolution and is based on
TileGrid
'sgetZForResolution
method https://github.com/openlayers/openlayers/blob/main/src/ol/tilegrid/TileGrid.js#L634This method is based on the
this.resolutions_
list of grid resolutions. The index of the resolution closest to that in parameter is then set to the min or max zoom value.So if
this.resolutions_
contains 24 values but maxZoom is 19, then when the map is at levels 20, 21, 22, 23 and 24, the grid will limit queries to zoom 19.Funded by FM Projet