Skip to content

perfectline/geopoint

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

Javascript GeoPoint Library

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

Convert decimal -> degrees

<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>

Convert degrees -> decimal

<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>

Authors

Tanel Suurhans (http://twitter.com/tanelsuurhans)
Tarmo Lehtpuu (http://twitter.com/tarmolehtpuu)

License

Copyright 2011 by PerfectLine LLC (http://www.perfectline.ee) and is released under the MIT license.

About

Simple Javascript library to convert latitude/longitude between decimal degrees and degrees,minutes and seconds.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published