Javascript library to convert latitude/longitude between decimal degrees and degrees,minutes and seconds.
This library expects latitude and longitude in EPSG:4326 (WGS84). To convert between different projections check out Proj4js
<script type="text/javascript" src="geopoint.js"></script>
<script type="text/javascript">
var lon = 24.72504500749274;
var lat = 58.74554729994484;
var point = new GeoPoint(lon, lat);
console.log(point.getLonDeg()); // 24° 43' 30.16"
console.log(point.getLatDeg()); // 58° 44' 43.97"
</script>
<script type="text/javascript" src="geopoint.js"></script>
<script type="text/javascript">
var lon = "24° 43' 30.16\"";
var lat = "58° 44' 43.97\"";
var point = new GeoPoint(lon, lat);
console.log(point.getLonDec()); // 24.725044444444443
console.log(point.getLatDec()); // 58.74554722222222
</script>
Tanel Suurhans (http://twitter.com/tanelsuurhans)
Tarmo Lehtpuu (http://twitter.com/tarmolehtpuu)
Copyright 2011 by PerfectLine LLC (http://www.perfectline.ee) and is released under the MIT license.