Module ellipsoidalKarney
Ellipsoidal geodetic (lat-/longitude) LatLon and geocentric (ECEF) Cartesian classed and functions areaOf, isclockwise and perimeterOf, all based on Charles Karney's Python
implementation of 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)
|
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 (n ellipsoidal) polygon. |
|
|
|
isclockwise(points,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
wrap=True)
Determine the direction of a path or polygon. |
|
|
|
perimeterOf(points,
closed=False,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
wrap=True)
Compute the perimeter of a (n ellipsoidal) 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 the polygon encloses a pole,
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 (n ellipsoidal) 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 .
|
isclockwise(points,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
wrap=True)
|
|
Determine the direction of a path or polygon.
- Parameters:
points - The path or polygon points (LatLon []).
datum - Optional datum (Datum).
wrap - Wrap and unroll longitudes (bool ).
- Returns:
True if points are clockwise,
False otherwise.
- Raises:
TypeError - Some points are not LatLon .
ValueError - Insufficient number of points or
points enclose a pole or zero area.
|
perimeterOf(points,
closed=False,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
wrap=True)
|
|
Compute the perimeter of a (n ellipsoidal) 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 .
|