Package pygeodesy :: Module bases
[frames] | no frames]

Module bases

(INTERNAL) Common base classes.

After (C) Chris Veness 2011-2015 published under the same MIT Licence**, see http://www.movable-type.co.uk/scripts/latlong.html and http://www.movable-type.co.uk/scripts/latlong-vectors.html.


Version: 17.06.04

Classes
  Base
(INTERNAL) Base class.
  LatLonHeightBase
(INTERNAL) Base class for LatLon points on spherical or ellipsiodal earth models.
  Named
(INTERNAL) Named base class.
  VectorBase
(INTERNAL) Used by vector3d.
Functions
 
isclockwise(points, radius=None)
Determine the direction of a polygon defined by a list, sequence, set or tuple of LatLon points.
 
isconvex(points, radius=None)
Determine whether a polygon defined by a list, sequence, set or tuple of LatLon points is convex.
Function Details

isclockwise(points, radius=None)

 

Determine the direction of a polygon defined by a list, sequence, set or tuple of LatLon points.

Parameters:
  • points - The points defining the polygon (LatLon[]).
  • radius - Optional, mean earth radius (meter).
Returns:
True if clockwise, False otherwise.
Raises:
  • TypeError - Some points are not LatLon.
  • ValueError - Too few points or zero area polygon.

Example:

>>> f = LatLon(45,1), LatLon(45,2), LatLon(46,2), LatLon(46,1)
>>> pygeodesy.isclockwise(f)  # False
>>> t = LatLon(45,1), LatLon(46,1), LatLon(46,2)
>>> pygeodesy.isclockwise(t)  # True

isconvex(points, radius=None)

 

Determine whether a polygon defined by a list, sequence, set or tuple of LatLon points is convex.

Parameters:
  • points - The points defining the polygon (LatLon[]).
  • radius - Optional, mean earth radius (meter).
Returns:
True if convex, False otherwise.
Raises:
  • TypeError - Some points are not LatLon.
  • ValueError - Too few points or colinear point.

Example:

>>> t = LatLon(45,1), LatLon(46,1), LatLon(46,2)
>>> pygeodesy.isconvex(t)  # True
>>> f = LatLon(45,1), LatLon(46,2), LatLon(45,2), LatLon(46,1)
>>> pygeodesy.isconvex(f)  # False