You can get the position of the marker by calling marker.getPosition(): http://code.google.com/apis/maps/documentation/javascript/reference.html#Marker
To be notified when the user drags the marker, listen for marker event 'position_changed'. On 26 Sep 2010 08:41, "BGibson" <[email protected]> wrote: > Does anybody know how to get the updated latlong of a draggable marker > in V3? I've seen tons of examples for V2 but that code does not work, > looked everywhere for a solution to this problem on the internet, > literally, for months, and never saw any solutions. I even posted in > another google discussion group and did not get any replies. > > So, I'm back at it and I'm getting ever so close, but my LatLng always > returns "NaN, NaN" as if it can't return the latlong of the new marker > placement. > > Currently, I have an event listener that looks like this: > > google.maps.event.addListener(marker, 'mouseup', function(event) { > updateLatLong(event.latLng); > }); > > function updateLatLong(location) > { > var newLocation = new google.maps.LatLng(location); > alert(newLocation); > } > > I have been trying for ages to get this to work for a client of mine, > who has a property rental site and his landlords want to be able to > change the marker locations of their property to show the building > instead of the street. But holy crap, this has been giving me a ton > of problems. > > If anybody can point me in the right direction, please let me know. > > For what it's worth, I've already tried using marker.getLatLng() and > it makes the function throw errors, screwing up my control in the map > (can't ever drop the marker). > > -- > 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]<google-maps-js-api-v3%[email protected]> . > For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en. > -- 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.
