new ol.Sphere(radius)
Name | Type | Description |
---|---|---|
radius |
number |
Radius. |
Methods
-
ol.Sphere.getArea(geometry, opt_options){number}
src/ol/sphere.js, line 211 -
Get the spherical area of a geometry. This is the area (in meters) assuming that polygon edges are segments of great circles on a sphere.
Name Type Description geometry
ol.geom.Geometry A geometry.
options
Options for the area calculation. By default, geometries are assumed to be in 'EPSG:3857'. You can change this by providing a
projection
option.Name Type Description projection
ol.ProjectionLike | undefined Projection of the geometry. By default, the geometry is assumed to be in EPSG:3857 (Web Mercator).
radius
number | undefined Sphere radius. By default, the radius of the earth is used (Clarke 1866 Authalic Sphere).
Returns:
The spherical area (in square meters).
-
ol.Sphere.getLength(geometry, opt_options){number}
src/ol/sphere.js, line 115 -
Get the spherical length of a geometry. This length is the sum of the great circle distances between coordinates. For polygons, the length is the sum of all rings. For points, the length is zero. For multi-part geometries, the length is the sum of the length of each part.
Name Type Description geometry
ol.geom.Geometry A geometry.
options
Options for the length calculation. By default, geometries are assumed to be in 'EPSG:3857'. You can change this by providing a
projection
option.Name Type Description projection
ol.ProjectionLike | undefined Projection of the geometry. By default, the geometry is assumed to be in EPSG:3857 (Web Mercator).
radius
number | undefined Sphere radius. By default, the radius of the earth is used (Clarke 1866 Authalic Sphere).
Returns:
The spherical length (in meters).
-
geodesicArea(coordinates){number}
src/ol/sphere.js, line 54 -
Returns the geodesic area for a list of coordinates.
Reference Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion Laboratory, Pasadena, CA, June 2007
Name Type Description coordinates
Array.<ol.Coordinate> List of coordinates of a linear ring. If the ring is oriented clockwise, the area will be positive, otherwise it will be negative.
Returns:
Area.
-
haversineDistance(c1, c2){number}
src/ol/sphere.js, line 67 -
Returns the distance from c1 to c2 using the haversine formula.
Name Type Description c1
ol.Coordinate Coordinate 1.
c2
ol.Coordinate Coordinate 2.
Returns:
Haversine distance.