Open spreadsheets https://spreadsheets.google.com/ccc?key=0AppCRCbx33I9dG5Wem1jTjMtbl9wTXpNUUUzOFl6TkE&hl=en
Credits and implementation code
http://www.movable-type.co.uk/scripts/latlong.html
Script interface
Copy Source | Copy HTML- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- /* Latitude/longitude spherical geodesy formulae & scripts spreadsheets interface */
- /* Credits - www.movable-type.co.uk/scripts/latlong.html */
-
-
- function GCDist(lat1, lon1, lat2, lon2) {
- // Return Great Circle Distance between points calculation
- var p1 = new LatLon(lat1, lon1);
- var p2 = new LatLon(lat2, lon2);
- var dist = p1.distanceTo(p2); // in km
- return dist;
- }
-
- function Bearing(lat1, lon1, lat2, lon2) {
- // Return Bearing between points calculation
- var p1 = new LatLon(lat1, lon1);
- var p2 = new LatLon(lat2, lon2);
- var brng = p1.bearingTo(p2); // in degrees clockwise from north
- return brng;
- }
-
- function Midpointlat(lat1, lon1, lat2, lon2) {
- // Returns the midpoint latitude between this point and the supplied point.
- var p1 = new LatLon(lat1, lon1);
- var p2 = new LatLon(lat2, lon2);
- var midp = p1.midpointTo(p2); // in deg
- return midp._lat;
- }
-
- function Midpointlon(lat1, lon1, lat2, lon2) {
- // Returns the midpoint longitude between this point and the supplied point.
- var p1 = new LatLon(lat1, lon1);
- var p2 = new LatLon(lat2, lon2);
- var midp = p1.midpointTo(p2); // in deg
- return midp._lon;
- }
-
- function Destpointlat(lat1, lon1, bearing, distance) {
- // Returns the destination point latitude from this point having travelled the given distance (in km) on the
- // given initial bearing (bearing may vary before destination is reached)
- var p1 = new LatLon(lat1, lon1);
- var midp = p1.destinationPoint(bearing, distance); // in degrees clockwise from north
- return midp._lat;
- }
-
- function Destpointlon(lat1, lon1, bearing, distance) {
- // Returns the destination point longitude from this point having travelled the given distance (in km) on the
- // given initial bearing (bearing may vary before destination is reached)
- var p1 = new LatLon(lat1, lon1);
- var midp = p1.destinationPoint(bearing, distance); // in degrees clockwise from north
- return midp._lon;
- }
-
No comments:
Post a Comment