Libraries of geodesy functions implemented in JavaScript – intended to serve as examples or starting-points for people wanting to develop geodesy applications (in JavaScript or other languages), though they can also be used as-is.
Meteor add garrilla:geodesy-libraries
This version is package for Meteor JS. It's provided as is. Only Changes from the original (vers 0.0.0) available at chrisvennes/geodesy are
- deletions to the use of
.require(<path>)
as this is a) not needed in Meteor and b) was breaking the package - change to the declarative style of the main functions to expressive style, e.g. from
function name()
toname = function()
A diff can be calculated between chrisvennes/geodesy and garrilla/geodesy
This is a library of geodesy functions for working with points and paths on (a spherical model of) the earth’s surface, including (orthodromic) great-circle geodesics and (loxodromic) rhumb lines. All calculations are done using spherical trigonometry.
The library includes the following functions:
distanceTo
destination point (using haversine formulation)bearingTo
destination pointfinalBearingTo
destination pointmidpointTo
destination pointdestinationPoint
following initial bearing for given distanceintersection
of two pathsrhumbDistanceTo
destination pointrhumbBearingTo
destination pointrhumbDestinationPoint
following given bearing for given distancerhumbMidpointTo
destination point
Full details are available at www.movable-type.co.uk/scripts/latlong.html.
Vincenty’s formulae for ‘direct and inverse solutions of geodesics on the ellipsoid’; these give distances and bearings on an ellipsoidal earth model accurate to within 0.5mm distance, 0.000015″ bearing.
The library includes the following wrapper functions:
distanceTo
destination pointinitialBearingTo
destination pointfinalBearingTo
destination pointdestinationPoint
following initial bearing for given distancefinalBearingOn
initial bearing for given distance
The heaving lifting is done in two routines:
direct
(implementing the direct solution of geodesics on the ellipsoid)inverse
(implementing the inverse solution of geodesics on the ellipsoid)
Full details are available at www.movable-type.co.uk/scripts/latlong-vincenty.html.
Geodesy tools for an ellipsoidal earth model.
The LatLonE
object incorporates not just latitude & longitude coordinates, but also the datum the
lat/lon point is defined on.
LatLonE
also holds ellipsoid parameters and Helmert transform parameters for translating between
different datums (e.g. between OSGB36 & WGS-84).
The convertDatum
function performs such translations between datums.
The library includes:
ellipsoid
parametersdatum
parameters (reference ellipsoid & Helmert transform parameters)convertDatum
: convert lat/lon point to new datumtoCartesian
: convert lat/lon point to ECEF 3-d vectortoLatLon
: convert ECEF 3-d vector to lat/lon point
More information at www.movable-type.co.uk/scripts/latlong-convert-coords.html.
This is a library of functions for working with points and paths on (a spherical model of) the earth’s surface using a vector-based approach using ‘n-vectors’ (rather than the more common spherical trigonometry; a vector-based approach makes most calculations much simpler, and easier to follow, compared with trigonometric equivalents).
The library includes:
distanceTo
destination pointbearingTo
destination pointmidpointTo
destination pointdestinationPoint
following initial bearing for given distanceintersection
of two pathscrossTrackDistanceTo
great circle pathenclosedBy
polygonmeanOf
set of points
More information at www.movable-type.co.uk/scripts/latlong-vectors.html.
Routines for converting between Ordnance Survey grid references and (OSGB-36) latitude/longitude coordinates, based on Ordnance Survey formulae.
The library includes:
latLonToOsGrid
: convert (OSGB) latitude/longitude to (numeric) OS grid referenceosGridToLatLon
: convert (numeric) OS grid reference to (OSGB) latitude/longitudeparse
standard format grid reference to numeric grid referencetoString
: convert numeric grid reference to standard format
More information at www.movable-type.co.uk/scripts/latlong-gridref.html.
Functions to convert geohash to/from latitude/longitude points, also to determine bounds of a geohash cell and find neighbours of a geohash.
The library includes:
encode
: latitude/longitude point to geohashdecode
: geohash to latitude/longitudebounds
of a geohash cellneighbours
: of a geohash
More information at www.movable-type.co.uk/scripts/geohash.html.
Tools for converting between numeric degrees and degrees / minutes / seconds.
The library includes the following functions:
parseDMS
: parse string representing degrees/minutes/seconds into numeric degreestoLat
: convert decimal degrees to latitudetoLon
: convert decimal degrees to longitudetoBrng
: convert decimal degrees to bearing
Documentation for all these methods is available at www.movable-type.co.uk/scripts/js/geodesy/docs.