Hi,
If you want to format your coordinates with minutes (') and seconds(")
you have to:
var y = 67.86079623925556
var minutes = 0.86079623925556 * 60 = 51.6477743553336
var seconds = 0.6477743553336 * 60 = 38.866461320016
y = Math.floor(y); // 67
minutes = Math.floor(minutes); //51 '
seconds = 38.866461320016 // 38.866461320016"
More about degrees, minutes and seconds:
http://en.wikipedia.org/wiki/Minute_of_arc
or http://id.mind.net/~zona/mmts/trigonometryRealms/degMinSec/degMinSec.htm
Sample function can look like that:
function formatCoords(lat, lon) {
var roundedLat = Math.floor(lat);
var minutesLat = (lat - roundedLat) * 60;
var secondsLat = (minutesLat - Math.floor(minutesLat)) * 60;
var latString = roundedLat + '° ' + Math.floor(minutesLat) + "' " +
((Math.round(secondsLat*100))/100) +'"';
var roundedLon = Math.floor(lon);
var minutesLon = (lon - roundedLon) * 60;
var secondsLon = (minutesLon - Math.floor(minutesLon)) * 60;
var lonString = roundedLon + '° ' + Math.floor(minutesLon) + "' " +
((Math.round(secondsLon*100))/100) +'"';
return new Array(latString, lonString);
}
Regards,
Michal Biniek
On 11 Gru, 09:30, Jonas SWE <[email protected]> wrote:
> Hello!
>
> I am a rookie on Google maps API and have som problems
>
> I want a site lite thishttp://econym.org.uk/gmap/example_geo.htm
>
> but i want to show coordinates like this
> sitehttp://www.findit.fi/sve/map/cordinates.asp?loc=Kiruna
>
> Moving around the marker showing
> ex. Latitud: N 67° 51' 17.44'' Longitud: E 20° 13' 32.99''
>
> anyone ? :)
--
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.