[T5] Getting LatLng from Google Map

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[T5] Getting LatLng from Google Map

badluck13
Ok, here is my new problem :)

I implemented google maps to one of my projects and everything is fine. I input coordinates and marker shows up and everything else is ok.

Now problem is that I want to drag marker across map and to get new coordinates to my form...

Problem is that this is all done in javascript and I don't know how to pass value from javascript to my page.

GEvent.addListener(marker, "dragend", function() {
              ??? = marker.getLatLng().lat();
              ??? = marker.getLatLng().lng();
           });

SO anyone have idea what to do?
Reply | Threaded
Open this post in threaded view
|

Re: [T5] Getting LatLng from Google Map

abangkis
Hi the easiest way is using hidden textfield (I've got this from
thiago advice).

in your form in tml file you have something like this :

                                <t:hidden t:id="hid" value="hiddenValue"/>

while in the java class you need this :

        @Property
        private String hiddenValue;

and in the javascript you just do something like this :

document.mapForm.hid.value = createMarkerData(gmarkers);

in my case every time a user click the map, it store the marker
location to an array. the createMarkerData function iterate this array
and append it to a string. Then the string is accesible through the
hiddenValue variables in the java class.

Hope this helps
Cheers

Abangkis

On Tue, Jan 26, 2010 at 5:29 PM, blueboy6 <[hidden email]> wrote:

>
> Ok, here is my new problem :)
>
> I implemented google maps to one of my projects and everything is fine. I
> input coordinates and marker shows up and everything else is ok.
>
> Now problem is that I want to drag marker across map and to get new
> coordinates to my form...
>
> Problem is that this is all done in javascript and I don't know how to pass
> value from javascript to my page.
>
> GEvent.addListener(marker, "dragend", function() {
>                ??? = marker.getLatLng().lat();
>                ??? = marker.getLatLng().lng();
>                  });
>
> SO anyone have idea what to do?
> --
> View this message in context: http://old.nabble.com/-T5--Getting-LatLng-from-Google-Map-tp27320566p27320566.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]