Marker Position

12 views
Skip to first unread message

Julio Cesar Gonzales Ochoa

unread,
Feb 26, 2016, 3:27:09 PM2/26/16
to gmaps4jsf-dev
Anyone know how to get the position (latitude and longitude) of a marker component via javascript. The marker component is jsVariable to "marker1". Here my code:

<m:map zoom="12" width="500px" height="500px" type="G_NORMAL_MAP" jsVariable="map" address="#{Alerta.address}">
    <m:mapControl name="GLargeMapControl" position="G_ANCHOR_BOTTOM_LEFT" />
    <m:mapControl name="GMapTypeControl" />
 
   <m:marker draggable="true" jsVariable="marker1">      
        <m:eventListener eventName="dragend" jsFunction="actualizaMarker"/>
    </m:marker>

</m:map>


Greetings from Peru

Hazem Saleh

unread,
Feb 26, 2016, 5:08:16 PM2/26/16
to gmaps4jsf-dev
Just use:
var lat = marker1.getPosition().lat();
var lng = marker1.getPosition().lng();

An example of marker's jsVariable is available:
http://www.mashups4jsf.com/gmaps4jsf-examples/pages/jsVariableExample.jsp.source



--
You received this message because you are subscribed to the Google Groups "gmaps4jsf-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gmaps4jsf-de...@googlegroups.com.
To post to this group, send email to gmaps4...@googlegroups.com.
Visit this group at https://groups.google.com/group/gmaps4jsf-dev.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages