1
0
Fork 0
forked from 0x2620/oxjs
This commit is contained in:
rlx 2011-03-04 16:24:54 +00:00
commit 9067e96499
2 changed files with 141 additions and 35 deletions

View file

@ -1870,6 +1870,14 @@ Geo functions
return {lat: lat, lng: lng};
};
Ox.getDegreesPerMeter = function(lat) {
/*
>>> Ox.EARTH_CIRCUMFERENCE = 360 / Ox.getDegreesPerMeter(0)
true
*/
return 360 / Ox.EARTH_CIRCUMFERENCE / Math.cos(lat * Math.PI / 180);
};
Ox.getDistance = function(point0, point1) {
/*
>>> Ox.EARTH_CIRCUMFERENCE == Ox.getDistance({lat: -45, lng: -90}, {lat: 45, lng: 90}) * 2