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.

MarkerCluster.remove() not working as intended

See original GitHub issue

I’m submitting a … (check one with “x”)

  • question
  • any problem or bug report
  • feature request

If you choose ‘problem or bug report’, please select OS: (check one with “x”)

  • Android
  • iOS

cordova information: (run $> cordova plugin list)

com.googlemaps.ios 2.6.0 "Google Maps SDK for iOS"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-googlemaps 2.2.5 "cordova-plugin-googlemaps"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"

Current behavior: Hi, on Android when I execute the MarkerCluster.remove() function it spits out this error:

plugins/cordova-plugin-googlemaps/www/BaseClass.js:127 Cannot access to the 'remove' method.

If there are markers or marker clusters in your map camera view, then it won’t remove them. The old clusters and markers are still visible but not clickable anymore.

If you look away to place with no markers and marker clusters it removes them properly. And on iOS, it sometimes crashes when I call that function. Maybe from the above error.

Expected behavior: It should remove all the markers and clusters associated with that MarkerCluster object.

Screen capture or video record: markerclusterremove

This was also tested on your marker cluster demo project (as seen in the above gif).

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
wf9a5m75commented, Feb 26, 2018

Ok, I updated the code. Please reinstall the plugin from the multiple_maps branch.

$> cordova plugin rm cordova-plugin-googlemaps

$> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="..."
0reactions
ghostcommented, Mar 13, 2018

When it will be released, as i don’t want to rely on source code, and i can wait.

I have also reviewed the bug, and i have seen a programmatic error in your code, when you define a variable you should use the interface instead of the implementation.

The Map fix is not right also, as you should use:

private final static ConcurrentMap<String, STATUS> pluginMarkers = new ConcurrentHashMap<String, STATUS>();

ArrayList also a problem. I think that can be fixed easily on all your classes.

I’m not that fan of static member variables (it can cause lots of typical concurrency bugs, which are not easy to figure out), i think somehow the class is a little bit complex, i think, the java part can be easily refactored to introduce some official java principle.

I’m aware of that when somebody is experiencing among the solutions, the code quality can be very bad, but i would clean it up step by step if i had time on this.

It’s a massive work, so it does not make sense to me to contribute. Keep up the good work. I’m very impressed that you maintain this repository on daily basis for years now.

Most of the cordova plugin simply useless, because it’s not maintained. This is the first one, what i saw working. It was a little bit hard because the google shows me the old version of documents, maybe if something is deprecated like CAMERA_CHANGE, the old version of the document should be updated also. I was a little bit confused on the links, but the docs quality is good.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Marker cluster clearLayers method does not remove the layers ...
I'm using "leaflet.markercluster": "^1.5.0" into an Angular app. The marker cluster is created as follow:
Read more >
Leaflet.label and MarkerCluster problem with zoom ...
All works as planned until I zoom back out (points removed) and in again (points added). The labels no longer work for the...
Read more >
Leaflet.markercluster | Marker Clustering plugin for Leaflet
You are passed a MarkerCluster object, you'll probably want to use getChildCount() or getAllChildMarkers() to work out the icon to show. var markers...
Read more >
Remove elements from a map in leaflet - Rdrr.io
Description. Remove one or more features from a map, identified by layerId ; or, clear all features of the given type or group....
Read more >
Bug: Deleted markers reappear (v. 3.8) [35821662]
Below I've attached the sample code (attachment is not working!). If you click add and then remove, when you zoom the wrong marker...
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