The OpenLayers.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 OpenLayers.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. |
OpenLayers.Spherical.computeDistanceBetween = function( from, to, radius )
Computes the distance between two LonLats.
from | {OpenLayers.LonLat} or {Object} Starting point. A LonLat or a JavaScript literal with lon lat properties. |
to | {OpenLayers.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.
OpenLayers.Spherical.computeHeading = function( from, to )
Computes the heading from one LonLat to another LonLat.
from | {OpenLayers.LonLat} or {Object} Starting point. A LonLat or a JavaScript literal with lon lat properties. |
to | {OpenLayers.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.
OpenLayers.Spherical.computeDistanceBetween = function( from, to, radius )
Computes the heading from one LonLat to another LonLat.
OpenLayers.Spherical.computeHeading = function( from, to )