Esri / esri-leaflet-vector

Display ArcGIS Online vector basemaps w/ Esri Leaflet
Apache License 2.0
56 stars 57 forks source link

vectorBasemapLayer misalignment when zoom out to level 0 or 1 #125

Closed tripler closed 2 years ago

tripler commented 2 years ago

The vector basemap layer can become misaligned with the map when the zoom level is changed or when the basemap layer is first loaded before the map has been interacted with.

The easiest way to see a reproduction is via the "Simple DynamicMapLayer" example: https://esri.github.io/esri-leaflet/examples/simple-dynamic-map-layer.html

Simply zoom out to zoom level 1 or 0 and you will see the base layer "shift" under the overlay. This occurs in all browsers I've tested (Chrome, Edge, Firefox, Safari & Chrome Android).

image

image

Interacting with the map and toggling between zoom levels can sometimes "fix" level 1, but level 0 appears to always be misaligned. I'm experiencing this issue with my own use of vectorBasemapLayer as well.

Base layer alignment issues can also be observed via the "Switching basemaps" example: https://esri.github.io/esri-leaflet/examples/switching-basemaps.html

If you zoom out to map zoom level 2 or 3 and swap between base layers the newly loaded layer will be incorrectly aligned until a map interaction takes place, "snapping" it back into the proper place where it should have loaded. Sometimes the misalignment is subtle, other times it is quite dramatic.

image

image

These behaviors are also visible on the newer documentation examples: https://developers.arcgis.com/esri-leaflet/samples/simple-feature-layer/ https://developers.arcgis.com/esri-leaflet/maps/change-the-basemap-layer/

gavinr commented 2 years ago

Thank you for reporting this issue. To summarize the replication case:

  1. Browse to https://developers.arcgis.com/esri-leaflet/samples/simple-dynamic-map-layer/ in any browser
  2. Click the "zoom out" button the maximum number of times (~3 times)
    • Expected: map layer hovering in "same place" as original compared to basemap
    • Actual: map layer is hovering offset/incorrect compared to the basemap image

I agree that this seems like an issue and should be addressed. I'll try to take a look, but PRs are also welcome! Thanks!

gavinr commented 2 years ago

This was fixed in v3.1.3