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.

Relevant links

Summary
SphericalThe 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
computeDistanceBetweenComputes the distance between two LonLats.
computeHeadingComputes the heading from one LonLat to another LonLat.

Functions

computeDistanceBetween

ALKMaps.Spherical.computeDistanceBetween = function(from,
to,
radius)

Computes the distance between two LonLats.

Parameters

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.

Returns

{Float} The distance in meters.

computeHeading

ALKMaps.Spherical.computeHeading = function(from,
to)

Computes the heading from one LonLat to another LonLat.

Parameters

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.

Returns

{Float} The heading in degrees.

ALKMaps.Spherical.computeDistanceBetween = function(from,
to,
radius)
Computes the distance between two LonLats.
ALKMaps.Spherical.computeHeading = function(from,
to)
Computes the heading from one LonLat to another LonLat.
This class represents a longitude and latitude pair
Close