Skip to content

Visibility limits on layer are not consistent when switching CRS #10739

@MV88

Description

@MV88

Description

When setting visibility limits on a layer, for example on the current visualization scale, those limits are respected and the layer, for example if we set it invisible, the layer will disappear from the visualization of the map and this is correct.

When looking at the same map, switching the projection to EPSG:4326

We can see the visibility limits scale will change and the visibility limits seem not to be respected for the current visualization of the map in a different projection.

See video attached

What we ideally look for is to keep the same visualization limits and see no change in the layers visualization behaviour.

Ticket attachments :

recording_1.mp4

How to reproduce

  • go to display settings
  • set up visibility limits on a layer and stay there
  • change crs in the map

Expected Result

visibility limits gets recalculated on map crs change
Current Result

this are not recalculated correctly and layer may disappear

  • Not browser related
Browser info (use this site: https://www.whatsmybrowser.org/ for non expert users)
Browser Affected Version
Internet Explorer
Edge
Chrome
Firefox
Safari

Other useful information

The issue happens when some visibility limits are defined and then a crs for the map is changed
at this point the value of maxResolution and/or minResolution (it depends which one you have defined) are not updated accordingly in side layers properties ( state.layers.flat.layers[...] )
on a technical point of view when CHANGE_MAP_CRS is changed these two values are not updated accordingly.

we have to make sure that this is done, and maybe transform the CHANGE_MAP_CRS into a thunk action so that it can fetch info from state if needed to recalculate these values probably using

export function getCurrentResolution(currentZoom, minZoom, maxZoom, dpi) {
if (getHook("RESOLUTION_HOOK")) {
return getHook("RESOLUTION_HOOK")(currentZoom, minZoom, maxZoom, dpi);
}
/* if no hook is registered (leaflet) it is used the GoogleMercatorResolutions in
in order to get the list of resolutions */
return getGoogleMercatorResolutions(minZoom, maxZoom, dpi)[currentZoom];
}

Metadata

Metadata

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions