Geodesic calculations¶
This module defines the Geodesic class which can interface with the Proj geodesic functions. See the Proj geodesic page for more background information.
-
class
cartopy.geodesic.
Geodesic
(radius=6378137.0, flattening=1 / 298.257223563)¶ Define an ellipsoid on which to solve geodesic problems.
- Parameters
radius (float, optional) – Equatorial radius (metres). Defaults to the WGS84 semimajor axis (6378137.0 metres).
flattening (float, optional) – Flattening of ellipsoid. Setting flattening = 0 gives a sphere. Negative flattening gives a prolate ellipsoid. If flattening > 1, set flattening to 1/flattening. Defaults to the WGS84 flattening (1/298.257223563).
-
circle
(self, double lon, double lat, double radius, int n_samples=180, endpoint=False)¶ Find a geodesic circle of given radius at a given point.
- Parameters
lon (float) – Longitude coordinate of the centre.
lat (float) – Latitude coordinate of the centre.
radius (float) – The radius of the circle (metres).
n_samples (int, optional) – Integer number of sample points of circle.
endpoint (bool, optional) – Whether to repeat endpoint at the end of returned array.
- Returns
numpy.ndarray
, shape=(n_samples, 2) – The evenly spaced longitude-latitude points on the circle.
-
direct
(self, points, azimuths, distances)¶ Solve the direct geodesic problem where the length of the geodesic is specified in terms of distance.
Can accept and broadcast length 1 arguments. For example, given a single start point and distance, an array of different azimuths can be supplied to locate multiple endpoints.
- Parameters
- Returns
numpy.ndarray
, shape=(n, 3) – The longitudes, latitudes, and forward azimuths of the located endpoint(s).
-
geometry_length
(self, geometry)¶ Return the distance (in physical meters) of the given Shapely geometry.
The geometry is assumed to be in spherical (lon, lat) coordinates.
- Parameters
geometry (
shapely.geometry.BaseGeometry
) – The Shapely geometry to compute the length of. For polygons, the exterior length will be calculated. For multi-part geometries, the sum of the parts will be computed.
-
inverse
(self, points, endpoints)¶ Solve the inverse geodesic problem.
Can accept and broadcast length 1 arguments. For example, given a single start point, an array of different endpoints can be supplied to find multiple distances.
- Parameters
points (array_like, shape=(n or 1, 2)) – The starting longitude-latitude point(s) from which to travel.
endpoints (array_like, shape=(n or 1, 2)) – The longitude-latitude point(s) to travel to.
- Returns
numpy.ndarray
, shape=(n, 3) – The distances, and the (forward) azimuths of the start and end points.