question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
HarelMcommented, Nov 23, 2020

I’ve moved away from leaflet, sorry… Good luck though 😃

1reaction
HarelMcommented, Feb 25, 2018

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 and clearLayers

I would appreciate your help even though you are not getting paid (I’m not getting paid for this either… 😉).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Copy Marker - Etsy
Check out our copy marker selection for the very best in unique or custom, handmade pieces from our shops.
Read more >
Copy Paste Markers 2 - aescripts + aeplugins
Copy Paste Markers. Allows you to copy one or more markers and paste them on any other layer. Show me how it works....
Read more >
ELIMINATING DUPLICATED MARKERS
Hello group, Please can anyone share with me the code to eliminate duplicated markers. I already identified them using: print(dup <- findDupMarkers(snpmap, ...
Read more >
Proofreaders & Copy Markers - My Next Move
Mark copy to indicate and correct errors in type, arrangement, grammar, punctuation, or spelling, using standard printers' marks.
Read more >
drop.dupmarkers: Drop duplicate markers in qtl - Rdrr.io
Value. The input cross object, with any duplicate markers omitted (except for one). The marker retained will have consensus genotypes; if multiple versions ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found