Sunday, February 27, 2011

[Google Maps API v2] Re: About my Maps Digits.

A LatLng object has a toUrlValue method:
http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLng

toUrlValue accepts an optional integer parameter to specify how many
decimal places are required, so you could update your code like this:


google.maps.Event.addListener(gmap, "move", function() {
var center = gmap.getCenter();
document.getElementById("latlon").innerHTML =
center.toUrlValue(6);


});

Martin.


On Feb 28, 5:55 am, blakilox <g...@4ustralia.com> wrote:
> Hi, I am trying to work out how to reduce the amount of digits on my
> map (Where it echo's the Lat Long at the bottom) to 6 decimal places,
>
> This is the bit in the code where it echos the digits,
> At then moment, when i move my map I am getting 14 digits. Is that
> accurate to like less than 1 mm? I only want 6 digits. thanks so much,
> Gazz.
>
> My map is athttp://cairns.info
>
> <table width="640" border="0" cellpadding="4">
>   <tr>
>     <td width="448"><strong>Latitude, Longitude:&nbsp;&nbsp;</strong>
> <span id="latlon"></span></td>
>     <td width="170"><strong>Zoom level:</strong> <span id="zoom"></
> span></td>
>   </tr>
> </table>

--
You received this message because you are subscribed to the Google Groups "Google Maps API V2" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate