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

[Backport release_3_7] Fixing tiles resolutions #4633

Merged
merged 6 commits into from
Jul 17, 2024

Conversation

rldhont
Copy link
Collaborator

@rldhont rldhont commented Jul 17, 2024

Backport #4627 and #4634
Authored by: @rldhont

rldhont added 4 commits July 17, 2024 11:12
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
@github-actions github-actions bot added this to the 3.7.10 milestone Jul 17, 2024
@github-actions github-actions bot added map viewer sponsored development This development has been funded javascript Pull requests that update Javascript code run end2end If the PR must run end2end tests or not labels Jul 17, 2024
Copy link

FM Projet

@rldhont rldhont added run end2end If the PR must run end2end tests or not and removed run end2end If the PR must run end2end tests or not labels Jul 17, 2024
@github-actions github-actions bot added the tests unit tests and docker configuration for tests label Jul 17, 2024
@rldhont rldhont changed the title [Backport release_3_8] Fixing tiles resolutions [Backport release_3_7] Fixing tiles resolutions Jul 17, 2024
@github-actions github-actions bot added tests unit tests and docker configuration for tests and removed tests unit tests and docker configuration for tests labels Jul 17, 2024
* Native EPSG:3857 scales
* Tiles resolutions
@rldhont rldhont force-pushed the backport-4627-to-release_3_7 branch from cad39e0 to 9dc817f Compare July 17, 2024 14:18
@github-actions github-actions bot added tests unit tests and docker configuration for tests and removed tests unit tests and docker configuration for tests labels Jul 17, 2024
@rldhont rldhont merged commit f890bfe into 3liz:release_3_7 Jul 17, 2024
12 checks passed
@rldhont rldhont deleted the backport-4627-to-release_3_7 branch July 29, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 tests unit tests and docker configuration for tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant