if (overlay instanceof GMarker) {
alert(overlay.getLatLng());
}
http://code.google.com/apis/maps/documentation/reference.html#GMarker
On 28/04/2009, tk5ep <[email protected]> wrote:
>
> Hi all,
>
> Is there a way to get the lat/lng coordinates of a marker when right-
> clicking on it ?
>
> A have several markers that have been created with a left click. I
> added a function to edit the htmlwindow and would now like to draw
> concentric cercles from this marker with a right-click. But i need the
> lat/lng of the marker to do this....
>
> I could detect a right click on the marker with the "singlerightlick"
> event but i can't make it return the lat/lng of the marker. Here the
> part of code that works.
>
> ----------------------------------
> GEvent.addListener(map,"singlerightclick", function(point,src,overlay)
> {
> if (overlay) {
> if (overlay instanceof GMarker) { alert('marker'); }
> }
> else {
> alert('map');
> }
> });
> ---------------------------------
>
> I also tried another solution (creating a new marker and draw
> circles). I tried to trigger the following GEvent with a rightclick,
> but no success :
>
> -------------------------------------------------
> GEvent.addListener(map,"singlerightclick", function(point,src,overlay)
> {
> if (overlay) {
> if (overlay instanceof GMarker) { GEvent.trigger
> (overlay,"rightclick");
> }});
>
> GEvent.addListener(map,"rightclick",function() {
> alert('ok');
> });
> -----------------------------------------------
>
> Any suggestions ? There is maybe an easier solution...
> Thanks,
>
> >
>
--
Barry
- www.nearby.org.uk - www.geograph.org.uk -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---