Duplicate markers
See original GitHub issue- I’m reporting a bug, not asking for help
- I’m sure this is a Leaflet.MarkerCluster code issue, not an issue with my own code nor with the framework I’m using (Cordova, Ionic, Angular, React…)
- I’ve searched through the issues to make sure it’s not yet reported
How to reproduce
Not entirely sure, has to do with timing so it’s not straight forward. I think the case that I’m experiencing has the following characteristics: I’m changing the base layer of my map which adds and removes a tile layer. While doing do I change the markers inside the cluster. I have seen a similar stack trace when trying to add a cluster layer when there’s no base layer map so the zoom is not defined or something, but I’m not sure… Image of this issue can be seen here: https://github.com/IsraelHikingMap/Site/issues/582
I do get the following error message.
ERROR Error: Uncaught (in promise): TypeError: Cannot read property '_zoom' of undefined
TypeError: Cannot read property '_zoom' of undefined
at NewClass._addLayer (leaflet.markercluster.js:6)
at NewClass.addLayer (leaflet.markercluster.js:6)
at categories.layer.ts:135
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:392)
at Object.onInvoke (core.js:4629)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run (zone.js:142)
at zone.js:873
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:425)
at Object.onInvokeTask (core.js:4620)
at NewClass._addLayer (leaflet.markercluster.js:6)
at NewClass.addLayer (leaflet.markercluster.js:6)
at categories.layer.ts:135
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:392)
at Object.onInvoke (core.js:4629)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run (zone.js:142)
at zone.js:873
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:425)
at Object.onInvokeTask (core.js:4620)
at resolvePromise (zone.js:824)
at zone.js:876
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:425)
at Object.onInvokeTask (core.js:4620)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:424)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:192)
at drainMicroTaskQueue (zone.js:602)
at ZoneTask.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:503)
at invokeTask (zone.js:1540)
at XMLHttpRequest.globalZoneAwareCallback (zone.js:1566)
What behaviour I’m expecting and which behaviour I’m seeing
Number of element in a cluster should no grow when changing zoom level, but every time I change the zoom level more makers are added to the cluster. this only happens once I enter a “corrupted” state - meaning after an error message like the above is generated.
Minimal example reproducing the issue
Couldn’t create on… I’d be happy to help out but I’m not sure how…
Versions:
leaflet 1.2.0 leaflet.markercluster 1.2.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:22 (9 by maintainers)
Top GitHub Comments
I’ve moved away from leaflet, sorry… Good luck though 😃
I think I managed to reproduce it here: https://plnkr.co/edit/zDTjlHntbx0hQlUW3piJ?p=preview I think it’s something with the combination of
removeLayer
andclearLayers
I would appreciate your help even though you are not getting paid (I’m not getting paid for this either… 😉).