API Google MAPS

Hello everybody,

I’m working with Version 3 of Google Maps JavaScript API, and I have
the next code:

In a layout of my application:

. . .

in the view for the form:

<%= I18n.t("tog_conclave.fields.lat") %> <%=f.text_field :lat, :class=>"fieldbox" %> <%= I18n.t("tog_conclave.fields.lng") %> <%=f.text_field :lng, :class=>"fieldbox" %>

and showing the map with this:

and the problem that i have is that i want to take the lng and lat
from the marker but i can’t.

How can I resolve it?

Thanks for your help.

On 08/11/10 14:44, h0bit wrote:

//document.getElementById(“Longitud”).innerHTML = marker.getPosition().lng();
//document.getElementById(“Latitud”).innerHTML =
marker.getPosition().lat();

I think you just have to uncomment these lines and add some html like:

Longitude: <span id="Longitud"></span>
Latitude: <span id="Latitud"></span>

Wherever you want to display it.

(or perhaps if you want to use disabled textfields with id=“lng” | “lat”
uncomment:)

//document.getElementById(“lng”).value = marker.getPosition().lng();
//document.getElementById(“lat”).value = marker.getPosition().lat();

Or if you want to display it in an InfoWindow of the marker, add and
open a infoWindow to the marker, which shows

     marker.getPosition().lat(); marker.getPosition().lng();

Hope I could imply something helpful. But I am not absolutly sure.
Perhaps someone with more google-maps expirience can tell you more than
me. Or maybe you should try on the Google Maps API google-group (
http://groups.google.com/group/google-maps-js-api-v3 )


best regards
Bente P.