On Apr 26, 11:56 pm, Jean-Nicolas Boulay Desjardins <[email protected]> wrote: > Second question: > > Imagine the user drags the marker in another location. How can my app relate > the ID to the marker so I know which marker was moved? > > For example: marker 1 was added with other markers in the map, then the user > move's the marker to a new location this new location is attach to the ID > 1... The IDs could be in a array with the location attach to them and when > it is change it changes it also in the array... The second problem is that, > they might be another marker in the same location...
The safe answer is to use an existing property of a Marker. I'd suggest Title since it doesn't really have a user-interface impact. The other answer is that it's totally possible to add a new property to markers to keep track of that. Something like: google.maps.Marker.prototype.MyUniquePropertyName = 0; However, this should come with a disclaimer: API updates can break your map. Make sure that your property name does not conflict with anything used in the Marker class - in fact I recommend naming it something you know that Google will never use. > How can I remove all the markers in the map? Same answer as number 1. Keep an array of Markers that you add, then loop through the array calling setMap(null); Chad Killingsworth -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
