mapbox/mapbox-gl-leaflet

Leaflet markers move around on pan, depending on Zoom

oranoran opened this issue · 8 comments

When creating a mapgox-gl-leaflet map and adding Leaflet markers to it, these markers are not stable.
Markers move around (all at once) as the map is panned, so they are no longer where they are supposed to be.

To reproduce, simply check out this code pen.
It's a simple copy-paste of the Basic example from this project, with versions updated to mapbox-gl v2.5.1 and leaflet 1.7.1, and an added 2nd Leaflet marker.

You can see that markers move around as the map is panned (also recorded in this video).

In other experiments I made (but unfortunately I didn't capture these), this would happen only at some zoom levels. So if I start at zoom level 5 everything is cool, then I zoom out and it breaks, I zoom out some more and it's ok, I zoom out some more and it breaks again.

Having the same issue with geoJSON layers (polygon layers as well). At the same time I am having the issue #145 . @oranoran did you find a solution/workaround for this?

I tried to add my geoJSON layer with addSource. But unfortunately i receive undefined for gl.getMapboxMap().

Any ideas to solve this issue?

Having the same issue with geoJSON layers (polygon layers as well). At the same time I am having the issue #145 . @oranoran did you find a solution/workaround for this?

Nope, for now I reverted back from GL to using a TileLayer.

But long-term, if this isn't resolved somehow, I will need to either drop Leaflet and stay with MapBase vanilla, or drop MapBase and use some other backend.

I'm also having this issue and it's a real shame as I have several highly interactive Leaflet maps that have markers, wms, etc that get stuck when panning with GL. Is there a work around? @oranoran you said you reverted to using a tileLayer, is that still a mapbox vector layer?

I've the same problem on a map. Downgrading mapbox-leaflet-gl to v0.0.7 works. From v0.0.8 the problem with the markers/map not moving synchronously appears.

On v0.0.8 a padding option has been added (v0.0.7...v0.0.8#diff-c10a1c84c325e16badffd67a4a9a005cee3b6228787969d42e293ff61c299059R18). Could it be the source of the problem?

In fact, I also reproduce it with the v0.0.7. The cases are less often but the bug is still here.

same problem here

Downgrading mapbox-gl to 1.13.1 solved it for me

Same bug in 3/7/23 but the above downgrade works for me.
I actually went to 2.0.0 and it works great.