The ALKMaps.Spherical namespace includes utility functions for calculations on the basis of a spherical earth (ignoring ellipsoidal effects), which is accurate enough for most purposes.
Spherical | The ALKMaps.Spherical namespace includes utility functions for calculations on the basis of a spherical earth (ignoring ellipsoidal effects), which is accurate enough for most purposes. |
Functions | |
computeDistanceBetween | Computes the distance between two LonLats. |
computeHeading | Computes the heading from one LonLat to another LonLat. |
ALKMaps.Spherical.computeDistanceBetween = function( from, to, radius )
Computes the distance between two LonLats.
from | {ALKMaps.LonLat} or {Object} Starting point. A LonLat or a JavaScript literal with lon lat properties. |
to | {ALKMaps.LonLat} or {Object} Ending point. A LonLat or a JavaScript literal with lon lat properties. |
radius | {Float} The radius. Optional. Defaults to 6378137 meters. |
{Float} The distance in meters.
ALKMaps.Spherical.computeHeading = function( from, to )
Computes the heading from one LonLat to another LonLat.
from | {ALKMaps.LonLat} or {Object} Starting point. A LonLat or a JavaScript literal with lon lat properties. |
to | {ALKMaps.LonLat} or {Object} Ending point. A LonLat or a JavaScript literal with lon lat properties. |
{Float} The heading in degrees.
Computes the distance between two LonLats.
ALKMaps.Spherical.computeDistanceBetween = function( from, to, radius )
Computes the heading from one LonLat to another LonLat.
ALKMaps.Spherical.computeHeading = function( from, to )