Ben Walker
Posts: 0
Joined: Mon Jan 19, 2015 2:13 pm

How to delete old markers from G-map

I am using a list service to show multiple markers on G-map, the locations are stored in a DB.

I am able to use a delete service to delete a location in the DB (this occurs successfully) however when I run the list service again, the marker associated with the deleted location is still there.

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

How to delete old markers from G-map

Ben, the marker, once dropped on the map follows it along like a puppy follows its owner.

The puppy has knowledge of its owner, and the marker also knows it's owner. To delete a marker from a map, you tell the marker ( not the map) to delete it's knowledge of its owner ... The map.

Learn more here:

https://developers.google.com/maps/do...

Also.. The syntax is

omarker:setmap( null ) ;

Where 'omarker' is the name of your marker. If you are not already doing so, if you create multiple markers ... You need to store them in a persistent array ( not local to your UI or method ) ... And then when you refresh your map, spin through the array ... Remove the map from the marker using the syntax above, kill the aray, and then Rebuild a new array with the new markers.

Example code on the Google website ...( see link above )

Best

Bruce

Return to “Issues”