Package pygeodesy :: Package geodesicx :: Module gxarea :: Class GeodesicAreaExact |
[frames] | no frames]

# Class GeodesicAreaExact

      object --+
               |
    named._Named --+
                   |
    named._NamedBase --+
                       |
                      GeodesicAreaExact

Known Subclasses:
  - PolygonArea

Area and perimeter of a geodesic polygon, an enhanced version of Karney's Python class PolygonArea using the more accurate surface area.

Note: The name of this class `*Exact` is a misnomer, see Karney's comments at C++ attribute GeodesicExact._c2.

Instance Methods
__init__(self, geodesic, polyline=False, **name) New GeodesicAreaExact instance. |
AddEdge(self, azi, s) Add another polygon edge. |
AddPoint(self, lat, lon) Add another polygon point. |
Compute(self, reverse=False, sign=True) Compute the accumulated perimeter and area. |
Reset(self) Reset this polygon to empty. |
Clear(self) Reset this polygon to empty. |
TestEdge(self, azi, s, reverse=False, sign=True) Compute the properties for a tentative, additional edge |
TestPoint(self, lat, lon, reverse=False, sign=True) Compute the properties for a tentative, additional vertex |
toStr(self, prec=6, sep=', ', **unused) Return this `GeodesicExactArea` as string. |
Inherited from `named._NamedBase`: `__repr__`, `__str__`, `others`, `toRepr` Inherited from `named._Named`: `__imatmul__`, `__matmul__`, `__rmatmul__`, `attrs`, `classof`, `copy`, `dup`, `methodname`, `rename`, `renamed`, `toStr2` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| area0x
| area0
| ellipsoid
| geodesic
| earth
| lat0
| lat1
| lon0
| lon1
| num
| polyline
| verbose
Inherited from `named._Named`: `classname`, `classnaming`, `iteration`, `name`, `named`, `named2`, `named3`, `named4`, `sizeof` Inherited from `object`: `__class__`

Method Details

### __init__ (self, geodesic, polyline=False, **name) (Constructor) |
New GeodesicAreaExact instance. Arguments: `geodesic` - A geodesic (GeodesicExact, wrapped `Geodesic` or GeodesicSolve). `polyline` - If `True`, compute the perimeter only, otherwise area and perimeter (`bool`). `name` - Optional `name=NN` (`str`). Raises: `GeodesicError` - Invalid `geodesic`. Overrides: object.__init__

### AddEdge (self, azi, s) |
Add another polygon edge. Arguments: `azi` - Azimuth at the current point (compass `degrees360`). `s` - Length of the edge (`meter`).

### AddPoint (self, lat, lon) |
Add another polygon point. Arguments: `lat` - Latitude of the point (`degrees`). `lon` - Longitude of the point (`degrees`).

### Compute (self, reverse=False, sign=True) |
Compute the accumulated perimeter and area. Arguments: `reverse` - If `True`, clockwise traversal counts as a positive area instead of counter-clockwise (`bool`). `sign` - If `True`, return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the area for the rest of the earth. Returns: Area3Tuple`(number, perimeter, area)` with the number of points, the perimeter in `meter` and the area in `meter**2`. The perimeter includes the length of a final edge, connecting the current to the initial point, if this polygon was initialized with `polyline=False`. For perimeter only, i.e. `polyline=True`, area is `NAN`. Notes: Arbitrarily complex polygons are allowed. In the case of self-intersecting polygons, the area is accumulated "algebraically". E.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. More points and edges can be added after this call.

### TestEdge (self, azi, s, reverse=False, sign=True) |
Compute the properties for a tentative, additional edge Arguments: `azi` - Azimuth at the current the point (compass `degrees`). `s` - Length of the edge (`meter`). `reverse` - If `True`, clockwise traversal counts as a positive area instead of counter-clockwise (`bool`). `sign` - If `True`, return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the area for the rest of the earth. Returns: Area3Tuple`(number, perimeter, area)`. Raises: `GeodesicError` - No points.

### TestPoint (self, lat, lon, reverse=False, sign=True) |
Compute the properties for a tentative, additional vertex Arguments: `lat` - Latitude of the point (`degrees`). `lon` - Longitude of the point (`degrees`). `reverse` - If `True`, clockwise traversal counts as a positive area instead of counter-clockwise (`bool`). `sign` - If `True`, return a signed result for the area if the polygon is traversed in the "wrong" direction instead of returning the area for the rest of the earth. Returns: Area3Tuple`(number, perimeter, area)`.

### toStr (self, prec=6, sep=', ', **unused) |
Return this `GeodesicExactArea` as string. Arguments: `prec` - The `float` precision, number of decimal digits (0..9). Trailing zero decimals are stripped for `prec` values of 1 and above, but kept for negative `prec` values. `sep` - Separator to join (`str`). Returns: Area items (`str`). Overrides: named._Named.toStr

Property Details

### area0x Get method: _fget(inst) - Get and cache/memoize the `property` value. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### area0 Get method: _fget(inst) - Get and cache/memoize the `property` value. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### ellipsoid Get method: _fget(inst) - Get and cache/memoize the `property` value. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### geodesic Get method: _fget(inst) - Get and cache/memoize the `property` value. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### earth Get method: _fget(inst) - Get and cache/memoize the `property` value. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### lat0 Get method: lat0(self) - Get the first point's latitude (`degrees`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### lat1 Get method: lat1(self) - Get the most recent point's latitude (`degrees`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### lon0 Get method: lon0(self) - Get the first point's longitude (`degrees`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### lon1 Get method: lon1(self) - Get the most recent point's longitude (`degrees`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### num Get method: num(self) - Get the current number of points (`int`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### polyline Get method: _fget(inst) - Get and cache/memoize the `property` value. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### verbose Get method: _fget(inst) - Get and cache/memoize the `property` value. Set method: _fset(inst, val) - Set and cache, memoize the `property` value. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.