A pure Python implementation of geodesy tools for various ellipsoidal
and spherical earth models using precision trigonometric and vector-based
methods for geodetic (lat-/longitude) and geocentric cartesian (x/y/z)
coordinates.
The tests have been run in 64-bit only with PyPy-Python 2.7.13, Python
2.7.14 (and numpy 1.13.1), Intel-Python 3.5.3 (and numpy 1.11.3) and
Python 3.6.4, all on macOS 10.13.2 High Sierra and with Pythonista 3.2
Python 2.7.12 and 3.6.1 (both with numpy 1.8.0) on iOS 11.2.1.
Previously, the tests were run with 64-bit Python 2.6.9 (and numpy
1.6.2), 2.7.10 (and numpy 1.8.0rc1), 2.7.13, 3.5.3, 3.6.2 and 3.6.3 on
MacOS X 10.10 Yosemite, MacOS X 10.11 El Capitan and/or macOS 10.12
Sierra, with Pythonista 3.1 on iOS 10.3.3, 11.0.3 and 11.1.2, with 32-bit
Python 2.6.6 on Windows XP SP3 and with 32-bit Python 2.7.14 on Window 10
Pro.
Some function and method names differ from the JavaScript version. In
such cases documentation tag JS name: shows the original
JavaScript name.
|
nearestOn2(point,
points,
radius=6371008.77141,
**options)
Locate the closest point on any segment between two consecutive
points of a path. |
|
|
|
bearingDMS(bearing,
form=' d ' ,
prec=None,
sep='
' )
Convert bearing to a string. |
|
|
|
bounds(points,
radius=None,
wrap=True,
LatLon=None)
Determine the lower-left and upper-right corners of a polygon defined
by a list, sequence, set or tuple of LatLon points. |
|
|
|
cbrt(x)
Compute the cubic root x**(1/3). |
|
|
|
cbrt2(x)
Compute the cubic root squared x**(2/3). |
|
|
|
classname(obj)
Build module.class name of this object. |
|
|
|
clipDMS(deg,
limit)
Clip a lat- or longitude to the given range. |
|
|
|
compassAngle(lat0,
lon0,
lat1,
lon1)
Return the angle from North for the direction vector (lon1 - lon0, lat1 - lat0) between two points. |
|
|
|
compassDMS(bearing,
form=' d ' ,
prec=None,
sep='
' )
Convert bearing to a string suffixed with compass point. |
|
|
|
compassPoint(bearing,
prec=3)
Convert bearing to a compass point. |
|
|
|
crosserrors(raiser=None)
Get/set cross product exceptions. |
|
|
|
degrees(x)
Convert angle x from radians to degrees. |
|
|
|
degrees180(rad)
Convert and wrap radians to degrees -180..+180. |
|
|
|
degrees360(rad)
Convert and wrap radians to degrees 0..+360. |
|
|
|
degrees90(rad)
Convert and wrap radians to degrees -270..+90. |
|
|
|
|
|
|
|
fStr(floats,
prec=6,
sep=' , ' ,
fmt=' %.*f ' ,
ints=False)
Convert floats to string, optionally with trailing zero decimals
stripped. |
|
|
|
fStrzs(fstr)
Strip trailing zero decimals from a float string. |
|
|
|
false2f(value,
name=' value ' ,
false=True)
Convert a false east-/northing to non-negative float. |
|
|
|
favg(v1,
v2,
f=0.5)
Return the weighted average of two values. |
|
|
|
fdot(a,
*b)
Return the precision dot product sum(a[i] * b[i] for
i in range(len(a))). |
|
|
|
fdot3(a,
b,
c,
start=0)
Return the precision dot product sum(a[i] * b[i] *
c[i] for i in range(len(a))) + start. |
|
|
|
fmean(floats)
Compute the mean of float values. |
|
|
|
fpolynomial(x,
*cs)
Evaluate the polynomial sum(cs[i] * x**i),
i=0..len(cs)). |
|
|
|
fsum(iterable)
Return an accurate floating point sum of values in the iterable. |
|
|
|
ft2m(feet)
Convert feet to meter (m). |
|
|
|
halfs(str2)
Split a string in 2 halfs. |
|
|
|
haversine(lat1,
lon1,
lat2,
lon2,
radius=6371008.77141)
Compute the distance between two points using the Haversine formula. |
|
|
|
|
|
heightOf(angle,
distance,
radius=6371008.77141)
Determine the height above the (spherical) earth after traveling
along a straight line at a given tilt. |
|
|
|
horizon(height,
radius=6371008.77141,
refraction=False)
Determine the distance to the horizon from a given altitude above the
(spherical) earth. |
|
|
|
hypot(x,
y)
Return the Euclidean distance, sqrt(x*x + y*y). |
|
|
|
hypot1(x)
Compute the norm sqrt(1 + x**2). |
|
|
|
hypot3(x,
y,
z)
Compute the norm sqrt(x**2 + y**2 + z**2). |
|
|
|
inStr(inst,
*args,
**kwds)
Return the string representation of an instance. |
|
|
|
isNumpy2(obj)
Check for Numpy2LatLon points wrapper. |
|
|
|
isTuple2(obj)
Check for Tuple2LatLon points wrapper. |
|
|
|
isclockwise(points,
radius=None,
wrap=True)
Determine the direction of a polygon defined by an array, list,
sequence, set or tuple of LatLon points. |
|
|
|
isconvex(points,
radius=None,
wrap=True)
Determine whether a polygon defined by an array, list, sequence, set
or tuple of LatLon points is convex. |
|
|
|
isenclosedby(latlon,
points,
wrap=False)
Determine whether a point is enclosed by a polygon defined by an
array, list, sequence, set or tuple of LatLon points. |
|
|
|
isfinite(obj)
Check for Inf and NaN values. |
|
|
|
isint(obj,
both=False)
Check for integer type or integer value. |
|
|
|
|
|
issequence(obj,
*excluded)
Check for sequence types. |
|
|
|
iterNumpy2(obj)
Iterate over Numpy2 wrappers or other sequences exceeding the
threshold. |
|
|
|
|
|
latDMS(deg,
form=' dms ' ,
prec=2,
sep='
' )
Convert latitude to a string suffixed with N or S. |
|
|
|
len2(seq)
Make built-in function len work for
generators, iterators, etc. |
|
|
|
lonDMS(deg,
form=' dms ' ,
prec=2,
sep='
' )
Convert longitude to a string suffixed with E or W. |
|
|
|
m2NM(meter)
Convert meter to nautical miles (NM). |
|
|
|
m2SM(meter)
Convert meter to statute miles (SM). |
|
|
|
m2ft(meter)
Convert meter to feet (ft). |
|
|
|
m2km(meter)
Convert meter to kilo meter (km). |
|
|
|
map1(func,
*args)
Apply each argument to a single-argument function and return a tuple
of results. |
|
|
|
map2(func,
*args)
Apply arguments to a function and return a tuple of results. |
|
|
|
normDMS(strDMS,
norm='
' )
Normalize all degree ˚, minute ' and second " symbols in a
string to the default symbols °, ′ and ″. |
|
|
|
parse3llh(strll,
height=0,
sep=' , ' )
Parse a string representing lat-, longitude and height point. |
|
|
|
parseDMS(strDMS,
suffix=' NSEW ' ,
sep='
' ,
clip=0)
Parse a string representing deg°min′sec″ to degrees. |
|
|
|
parseDMS2(strLat,
strLon,
sep='
' ,
latLimit=90)
Parse lat- and longitude representions. |
|
|
|
parseMGRS(strMGRS,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... )
Parse a string representing a MGRS grid reference, consisting of
zoneBand, grid, easting and northing. |
|
|
|
parseOSGR(strOSGR)
Parse an OSGR coordinate string to an Osgr instance. |
|
|
|
parseUTM(strUTM,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... )
Parse a string representing a UTM coordinate, consisting of zone,
hemisphere, easting and northing. |
|
|
|
parseWM(strWM,
radius=6378137.0)
Parse a string representing a WM coordinate, consisting of easting,
northing and an optional radius. |
|
|
|
polygon(points,
closed=True,
base=None)
Check a polygon given as an array, list, sequence, set or tuple of
points. |
|
|
|
precision(form,
prec=None)
Set the default precison for a given F_ form. |
|
|
|
radians(x)
Convert angle x from degrees to radians. |
|
|
|
radiansPI(deg)
Convert and wrap degrees to radians -PI..+PI. |
|
|
|
radiansPI2(deg)
Convert and wrap degrees to radians 0..+2PI. |
|
|
|
radiansPI_2(deg)
Convert and wrap degrees to radians -3PI/2..+PI/2. |
|
|
|
rangerror(error=None)
Raise an error for out-of-range lat- or longitudes. |
|
|
|
scalar(value,
low=2.22044604925e-16,
high=1.0,
name=' scalar ' )
Validate a scalar. |
|
|
|
simplify1(points,
distance,
radius=6371008.77141,
adjust=True,
indices=False)
Basic simplification of a path of LatLon points. |
|
|
|
simplify2(points,
pipe,
radius=6371008.77141,
adjust=True,
shortest=False,
indices=False)
Reumann-Witkam simplification of a path of LatLon points. |
|
|
|
simplifyRDP(points,
distance,
radius=6371008.77141,
adjust=True,
shortest=False,
indices=False)
Ramer-Douglas-Peucker (RDP) simplification of a path of LatLon
points. |
|
|
|
simplifyRDPm(points,
distance,
radius=6371008.77141,
adjust=True,
shortest=False,
indices=False)
Modified Ramer-Douglas-Peucker (RDP) simplification of a path of
LatLon points. |
|
|
|
simplifyRW(points,
pipe,
radius=6371008.77141,
adjust=True,
shortest=False,
indices=False)
Reumann-Witkam simplification of a path of LatLon points. |
|
|
|
simplifyVW(points,
area,
radius=6371008.77141,
adjust=True,
attr=None,
indices=False)
Visvalingam-Whyatt (VW) simplification of a path of LatLon
points. |
|
|
|
simplifyVWm(points,
area,
radius=6371008.77141,
adjust=True,
attr=None,
indices=False)
Modified Visvalingam-Whyatt (VW) simplification of a path of
LatLon points. |
|
|
|
tanPI_2_2(rad)
Compute the tangent of half angle, 90 degrees rotated. |
|
|
|
tan_2(rad)
Compute the tangent of half angle. |
|
|
|
toDMS(deg,
form=' dms ' ,
prec=2,
sep='
' ,
ddd=2,
neg=' - ' ,
pos='
' )
Convert signed degrees to string, without suffix. |
|
|
|
toLcc(latlon,
conic=Conic(name='WRF_Lb', lat0=40, lon0=-97, par1=33, par2=45, E0=0... ,
height=None,
Lcc=<class 'pygeodesy.lcc.Lcc'>)
Convert an (ellipsoidal) geodetic point to a Lambert location. |
|
|
|
toMgrs(utm,
Mgrs=<class 'pygeodesy.mgrs.Mgrs'>)
Convert a UTM coordinate to an MGRS grid reference. |
|
|
|
toOsgr(latlon,
lon=None,
datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Tran... ,
Osgr=<class 'pygeodesy.osgr.Osgr'>)
Convert a lat-/longitude point to an OSGR coordinate. |
|
|
|
toUtm(latlon,
lon=None,
datum=None,
Utm=<class 'pygeodesy.utm.Utm'>)
Convert a lat-/longitude point to a UTM coordinate. |
|
|
|
toWm(latlon,
lon=None,
radius=6378137.0,
Wm=<class 'pygeodesy.webmercator.Wm'>)
Convert a lat-/longitude point to a WM coordinate. |
|
|
|
wrap180(deg)
Wrap degrees to -180..+180. |
|
|
|
wrap360(deg)
Wrap degrees to 0..+360. |
|
|
|
wrap90(deg)
Wrap degrees to -270..+90. |
|
|
|
wrapPI(rad)
Wrap radians to -PI..+PI. |
|
|
|
wrapPI2(rad)
Wrap radians to 0..+2PI. |
|
|
|
wrapPI_2(rad)
Wrap radians to -3PI/2..+PI/2. |
|
|
|
version = ' 18.1.9 '
Normalized PyGeodesy version (string).
|
|
Conics = Conics.Be08Lb: Conic(name='Be08Lb', lat0=50.797815, l...
Registered conics (enum).
|
|
Datums = Datums.BD72: Datum(name='BD72', ellipsoid=Ellipsoids....
Registered datums (enum).
|
|
EPS = 2.22044604925e-16
System's epsilon (float)
|
|
EPS1 = 1.0
1 - EPS (float), about 0.9999999999999998
|
|
EPS2 = 1.49011611938e-08
sqrt(EPS) (float)
|
|
Ellipsoids = Ellipsoids.Airy1830: Ellipsoid(name='Airy1830', a...
Registered ellipsoids (enum).
|
|
F_D = ' d '
Format degrees as deg° (string).
|
|
F_DEG = ' deg '
Format degrees as [D]DD without symbol (string).
|
|
F_DM = ' dm '
Format degrees as deg°min′ (string).
|
|
F_DMS = ' dms '
Format degrees as deg°min′sec″ (string).
|
|
F_MIN = ' min '
Format degrees as [D]DDMM without symbols (string).
|
|
F_RAD = ' rad '
Convert degrees to radians and format as RR (string).
|
|
F_SEC = ' sec '
Format degrees as [D]DDMMSS without symbols (string).
|
|
PI = 3.14159265359
Constant math.pi (float)
|
|
PI2 = 6.28318530718
Two PI, math.pi * 2 (float)
|
|
PI_2 = 1.57079632679
Half PI, math.pi / 2 (float)
|
|
R_EQ = 6378137.0
Spherical earth radius at equator (meter).
|
|
R_KM = 6371.00877142
Mean, spherical earth radius (kilo meter).
|
|
R_M = 6371008.77141
Mean, spherical earth radius (meter).
|
|
R_NM = 3440.06953447
Mean, spherical earth radius (nautical miles).
|
|
R_SM = 3958.75339537
Mean, spherical earth radius (statute miles).
|
|
R_VM
Navigation/Aviation earth radius (meter).
|
|
S_DEG = ' \xc2\xb0 '
Degrees symbol ° (string).
|
|
S_MIN = ' \xe2\x80\xb2 '
Minutes symbol ′ (string).
|
|
S_RAD = '
'
Radians symbol (string).
|
|
S_SEC = ' \xe2\x80\xb3 '
Seconds symbol ″ (string).
|
|
S_SEP = '
'
Separator between deg°, min′ and sec″ (string).
|
|
Transforms = Transforms.BD72: Transform(name='BD72', tx=106.86...
Registered transforms (enum).
|