Page 1 of 1

How to delete old markers from G-map

Posted: Thu Jan 29, 2015 11:25 pm
by Ben Walker

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.


How to delete old markers from G-map

Posted: Fri Jan 30, 2015 1:43 am
by Bruce Stuart

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