Cordova-plugin-googlemaps: Error clearing the map after of create markercluster

Created on 28 Nov 2017  路  9Comments  路  Source: mapsplugin/cordova-plugin-googlemaps

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.5.0 "Google Maps SDK for iOS"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appminimize 1.0 "AppMinimize"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-dialogs 1.3.4 "Notification"
cordova-plugin-google-analytics 1.8.3 "Google Universal Analytics Plugin"
cordova-plugin-googlemaps 2.1.1 "cordova-plugin-googlemaps"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-native-spinner 1.1.3 "Native Spinner"
cordova-plugin-network-information 1.3.4 "Network Information"
cordova-plugin-overview 0.1.2 "Overview"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-statusbar 2.3.0 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-toast 2.6.0 "Toast"
cordova-sqlite-storage 2.1.2 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
onesignal-cordova-plugin 2.2.2 "OneSignal Push Notifications"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)
"@ionic-native/core": "4.3.2",
"@ionic-native/google-maps": "^4.4.2",

Current behavior:

i have the map and an markercluster added,
and when i call the "this.map.clear()" method in order to create othe marker cluster with different locations, this give me an error, "cannot read property apply of undefined"

Expected behavior:

call the method "this.map.clear()" an then create a new markercluster

Screen capture or video record:

eqwe
Related code, data or error log (please format your code or data):

The person who share your project files on Github (or other git repository) is in faster lane than other people.
Please share your project files on Github or others(Bitbucket, Gitlabs...etc).
If you don't want to share your project files, please create a demo project, then share it.

Screen captures, and/or native logs(such as Logcat, xcode logs) are appreciate.

Giving much information, you are waiting time is less.
Thank you for your cooperation.
bug fixed

Most helpful comment

bump

After messing with it for a couple days I managed to completely mess up my project to where google maps would never load. Version numbers got conflicted and I spent a whole day reverting things back to what the ionic docs tell you to do, and managed to get maps loading again, but I still cant remove markers. I can place markers and clusters, I can move and animate the map, everything else I wanna do works, I just cant run a map.clear() or a marker/cluster.remove()

Can anyone tell me when this will be pushed to master?
Or help me with my problems getting the other branch working? - With the other branch installed the only results I've gotten are build errors, the map being created but ready never being fired, or a working map with the inability to remove markers (same error as master branch)

Would appreciate some help, thanks.

All 9 comments

Sorry, the platform Is Android

Please share your project files on GitHub. I will check it

At least, you should use the same version for "@ionic-native/core": "4.3.2" as "@ionic-native/google-maps": "^4.4.2"

ping

try remove marker for marker with marker.remove()

Please use the multiple_maps branch.

When will be released this bugfix?

I am having the same problem running markerCluster.remove() or map.clear()

I have ran this command to install the branch to my project
npm install --save https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps

I already had that plugin registered with cordova so I didn't do it again.
This installed fine and can be seen in my package.json

"cordova-plugin-googlemaps": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps",
"cordova-plugin-googlemaps-sdk": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git",

But after rebuilding and running on android I get the same error:

Unhandled Promise rejection: Cannot read property 'apply' of undefined ; Zone: ; Task: null ; Value: TypeError: Cannot read property 'apply' of undefined

Cannot access to the 'remove' method.

Saw other people got this to work with the branch, not sure what I did wrong.

EDIT: I have now also tried re-adding the cordova plugin like this
cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="SOMETHING" --variable API_KEY_FOR_IOS="SOMETHING" --save

as per
https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1579

Still no change

bump

After messing with it for a couple days I managed to completely mess up my project to where google maps would never load. Version numbers got conflicted and I spent a whole day reverting things back to what the ionic docs tell you to do, and managed to get maps loading again, but I still cant remove markers. I can place markers and clusters, I can move and animate the map, everything else I wanna do works, I just cant run a map.clear() or a marker/cluster.remove()

Can anyone tell me when this will be pushed to master?
Or help me with my problems getting the other branch working? - With the other branch installed the only results I've gotten are build errors, the map being created but ready never being fired, or a working map with the inability to remove markers (same error as master branch)

Would appreciate some help, thanks.

Was this page helpful?
0 / 5 - 0 ratings