Module ellipsoidalKarney
Ellipsoidal geodetic (lat-/longitude) and cartesian (x/y/z) classes LatLon and Cartesian and functions areaOf and perimeterOf based on the Python implementation of
Charles F. F. Karney's GeographicLib.
Here's an example usage of ellipsoidalKarney
:
>>> from pygeodesy.ellipsoidalKarney import LatLon
>>> Newport_RI = LatLon(41.49008, -71.312796)
>>> Cleveland_OH = LatLon(41.499498, -81.695391)
>>> Newport_RI.distanceTo(Cleveland_OH)
866,455.4329098687 # meter
You can change the ellipsoid model used by the Karney formulae as
follows:
>>> from pygeodesy import Datums
>>> from pygeodesy.ellipsoidalKarney import LatLon
>>> p = LatLon(0, 0, datum=Datums.OSGB36)
or by converting to anothor datum:
>>> p = p.convertDatum(Datums.OSGB36)
|
LatLon
An ellipsoidal LatLon similar to ellipsoidalVincenty.LatLon but using Charles F.
F. Karney's Python GeographicLib to compute the geodesic distance,
initial and final bearing (azimuths) between two given points or
the destination point given a start point and an initial bearing.
|
|
Cartesian
Extended to convert (geocentric) Cartesian points to Karney-based (ellipsoidal)
geodetic LatLon.
|
|
ispolar(points,
wrap=False)
Check whether a polygon encloses a pole. |
|
|
|
areaOf(points,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
wrap=True)
Compute the area of a polygon. |
|
|
|
perimeterOf(points,
closed=False,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
wrap=True)
Compute the perimeter of a polygon. |
|
|
ispolar(points,
wrap=False)
|
|
Check whether a polygon encloses a pole.
- Parameters:
points - The polygon points (LatLon []).
wrap - Wrap and unroll longitudes (bool ).
- Returns:
True if a pole is enclosed by the polygon,
False otherwise.
- Raises:
ValueError - Insufficient number of points.
TypeError - Some points are not LatLon or don't have
bearingTo2 , initialBearingTo and
finalBearingTo methods.
|
areaOf(points,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
wrap=True)
|
|
Compute the area of a polygon.
- Parameters:
points - The polygon points (LatLon[]).
datum - Optional datum (Datum).
wrap - Wrap and unroll longitudes (bool ).
- Returns:
- Area (
meter , same as units of the datum
ellipsoid, squared).
- Raises:
ImportError - Package GeographicLib missing.
TypeError - Some points are not LatLon.
ValueError - Insufficient number of points or longitudes not wrapped,
unrolled, wrap is False .
|
perimeterOf(points,
closed=False,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
wrap=True)
|
|
Compute the perimeter of a polygon.
- Parameters:
points - The polygon points (LatLon[]).
closed - Optionally, close the polygon (bool ).
datum - Optional datum (Datum).
wrap - Wrap and unroll longitudes (bool ).
- Returns:
- Perimeter (
meter , same as units of the datum
ellipsoid).
- Raises:
ImportError - Package GeographicLib missing.
TypeError - Some points are not LatLon.
ValueError - Insufficient number of points or longitudes not wrapped,
unrolled, wrap is False .
|