pygeodesy 24.3.24__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PyGeodesy-24.3.24.dist-info/METADATA +272 -0
- PyGeodesy-24.3.24.dist-info/RECORD +115 -0
- PyGeodesy-24.3.24.dist-info/WHEEL +6 -0
- PyGeodesy-24.3.24.dist-info/top_level.txt +1 -0
- pygeodesy/LICENSE +21 -0
- pygeodesy/__init__.py +615 -0
- pygeodesy/__main__.py +103 -0
- pygeodesy/albers.py +867 -0
- pygeodesy/auxilats/_CX_4.py +218 -0
- pygeodesy/auxilats/_CX_6.py +314 -0
- pygeodesy/auxilats/_CX_8.py +475 -0
- pygeodesy/auxilats/__init__.py +54 -0
- pygeodesy/auxilats/__main__.py +86 -0
- pygeodesy/auxilats/auxAngle.py +548 -0
- pygeodesy/auxilats/auxDLat.py +302 -0
- pygeodesy/auxilats/auxDST.py +296 -0
- pygeodesy/auxilats/auxLat.py +848 -0
- pygeodesy/auxilats/auxily.py +272 -0
- pygeodesy/azimuthal.py +1150 -0
- pygeodesy/basics.py +892 -0
- pygeodesy/booleans.py +2031 -0
- pygeodesy/cartesianBase.py +1062 -0
- pygeodesy/clipy.py +704 -0
- pygeodesy/constants.py +516 -0
- pygeodesy/css.py +660 -0
- pygeodesy/datums.py +752 -0
- pygeodesy/deprecated/__init__.py +61 -0
- pygeodesy/deprecated/bases.py +40 -0
- pygeodesy/deprecated/classes.py +262 -0
- pygeodesy/deprecated/consterns.py +54 -0
- pygeodesy/deprecated/datum.py +40 -0
- pygeodesy/deprecated/functions.py +375 -0
- pygeodesy/deprecated/nvector.py +48 -0
- pygeodesy/deprecated/rhumbBase.py +32 -0
- pygeodesy/deprecated/rhumbaux.py +33 -0
- pygeodesy/deprecated/rhumbsolve.py +33 -0
- pygeodesy/deprecated/rhumbx.py +33 -0
- pygeodesy/dms.py +986 -0
- pygeodesy/ecef.py +1348 -0
- pygeodesy/elevations.py +279 -0
- pygeodesy/ellipsoidalBase.py +1224 -0
- pygeodesy/ellipsoidalBaseDI.py +913 -0
- pygeodesy/ellipsoidalExact.py +343 -0
- pygeodesy/ellipsoidalGeodSolve.py +343 -0
- pygeodesy/ellipsoidalKarney.py +403 -0
- pygeodesy/ellipsoidalNvector.py +685 -0
- pygeodesy/ellipsoidalVincenty.py +590 -0
- pygeodesy/ellipsoids.py +2476 -0
- pygeodesy/elliptic.py +1198 -0
- pygeodesy/epsg.py +243 -0
- pygeodesy/errors.py +804 -0
- pygeodesy/etm.py +1190 -0
- pygeodesy/fmath.py +1013 -0
- pygeodesy/formy.py +1818 -0
- pygeodesy/frechet.py +865 -0
- pygeodesy/fstats.py +760 -0
- pygeodesy/fsums.py +1898 -0
- pygeodesy/gars.py +358 -0
- pygeodesy/geodesicw.py +581 -0
- pygeodesy/geodesicx/_C4_24.py +1699 -0
- pygeodesy/geodesicx/_C4_27.py +2395 -0
- pygeodesy/geodesicx/_C4_30.py +3301 -0
- pygeodesy/geodesicx/__init__.py +48 -0
- pygeodesy/geodesicx/__main__.py +91 -0
- pygeodesy/geodesicx/gx.py +1382 -0
- pygeodesy/geodesicx/gxarea.py +535 -0
- pygeodesy/geodesicx/gxbases.py +154 -0
- pygeodesy/geodesicx/gxline.py +669 -0
- pygeodesy/geodsolve.py +426 -0
- pygeodesy/geohash.py +914 -0
- pygeodesy/geoids.py +1884 -0
- pygeodesy/hausdorff.py +892 -0
- pygeodesy/heights.py +1155 -0
- pygeodesy/interns.py +687 -0
- pygeodesy/iters.py +545 -0
- pygeodesy/karney.py +919 -0
- pygeodesy/ktm.py +633 -0
- pygeodesy/latlonBase.py +1766 -0
- pygeodesy/lazily.py +960 -0
- pygeodesy/lcc.py +684 -0
- pygeodesy/ltp.py +1107 -0
- pygeodesy/ltpTuples.py +1563 -0
- pygeodesy/mgrs.py +721 -0
- pygeodesy/named.py +1324 -0
- pygeodesy/namedTuples.py +683 -0
- pygeodesy/nvectorBase.py +695 -0
- pygeodesy/osgr.py +781 -0
- pygeodesy/points.py +1686 -0
- pygeodesy/props.py +628 -0
- pygeodesy/resections.py +1048 -0
- pygeodesy/rhumb/__init__.py +46 -0
- pygeodesy/rhumb/aux_.py +397 -0
- pygeodesy/rhumb/bases.py +1148 -0
- pygeodesy/rhumb/ekx.py +563 -0
- pygeodesy/rhumb/solve.py +572 -0
- pygeodesy/simplify.py +647 -0
- pygeodesy/solveBase.py +472 -0
- pygeodesy/sphericalBase.py +724 -0
- pygeodesy/sphericalNvector.py +1264 -0
- pygeodesy/sphericalTrigonometry.py +1447 -0
- pygeodesy/streprs.py +627 -0
- pygeodesy/trf.py +2079 -0
- pygeodesy/triaxials.py +1484 -0
- pygeodesy/units.py +969 -0
- pygeodesy/unitsBase.py +349 -0
- pygeodesy/ups.py +538 -0
- pygeodesy/utily.py +1231 -0
- pygeodesy/utm.py +762 -0
- pygeodesy/utmups.py +318 -0
- pygeodesy/utmupsBase.py +517 -0
- pygeodesy/vector2d.py +785 -0
- pygeodesy/vector3d.py +968 -0
- pygeodesy/vector3dBase.py +1049 -0
- pygeodesy/webmercator.py +383 -0
- pygeodesy/wgrs.py +439 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
u'''Exact ellipsoidal geodesy, intended I{for testing purposes only}.
|
|
5
|
+
|
|
6
|
+
Ellipsoidal geodetic (lat-/longitude) L{LatLon} and geocentric
|
|
7
|
+
(ECEF) L{Cartesian} classes and functions L{areaOf}, L{intersections2},
|
|
8
|
+
L{isclockwise}, L{nearestOn} and L{perimeterOf} based on module
|
|
9
|
+
L{geodsolve}, a wrapper invoking I{Karney}'s U{GeodSolve
|
|
10
|
+
<https://GeographicLib.SourceForge.io/C++/doc/GeodSolve.1.html>} utility.
|
|
11
|
+
'''
|
|
12
|
+
|
|
13
|
+
# from pygeodesy.datums import _WGS84 # from .ellipsoidalBase
|
|
14
|
+
from pygeodesy.ellipsoidalBase import CartesianEllipsoidalBase, \
|
|
15
|
+
_nearestOn, _WGS84
|
|
16
|
+
from pygeodesy.ellipsoidalBaseDI import LatLonEllipsoidalBaseDI, _TOL_M, \
|
|
17
|
+
_intersection3, _intersections2
|
|
18
|
+
# from pygeodesy.errors import _xkwds # from .karney
|
|
19
|
+
from pygeodesy.karney import fabs, _polygon, Property_RO, _xkwds
|
|
20
|
+
from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, _ALL_OTHER
|
|
21
|
+
from pygeodesy.points import _areaError, ispolar # PYCHOK exported
|
|
22
|
+
# from pygeodesy.props import Property_RO # from .karney
|
|
23
|
+
|
|
24
|
+
# from math import fabs # from .karney
|
|
25
|
+
|
|
26
|
+
__all__ = _ALL_LAZY.ellipsoidalGeodSolve
|
|
27
|
+
__version__ = '24.02.21'
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Cartesian(CartesianEllipsoidalBase):
|
|
31
|
+
'''Extended to convert exact L{Cartesian} to exact L{LatLon} points.
|
|
32
|
+
'''
|
|
33
|
+
|
|
34
|
+
def toLatLon(self, **LatLon_and_kwds): # PYCHOK LatLon=LatLon, datum=None
|
|
35
|
+
'''Convert this cartesian point to an exact geodetic point.
|
|
36
|
+
|
|
37
|
+
@kwarg LatLon_and_kwds: Optional L{LatLon} and L{LatLon} keyword
|
|
38
|
+
arguments as C{datum}. Use C{B{LatLon}=...,
|
|
39
|
+
B{datum}=...} to override this L{LatLon}
|
|
40
|
+
class or specify C{B{LatLon}=None}.
|
|
41
|
+
|
|
42
|
+
@return: The geodetic point (L{LatLon}) or if B{C{LatLon}} is C{None},
|
|
43
|
+
an L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C, M, datum)}
|
|
44
|
+
with C{C} and C{M} if available.
|
|
45
|
+
|
|
46
|
+
@raise TypeError: Invalid B{C{LatLon_and_kwds}} argument.
|
|
47
|
+
'''
|
|
48
|
+
kwds = _xkwds(LatLon_and_kwds, LatLon=LatLon, datum=self.datum)
|
|
49
|
+
return CartesianEllipsoidalBase.toLatLon(self, **kwds)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class LatLon(LatLonEllipsoidalBaseDI):
|
|
53
|
+
'''An ellipsoidal L{LatLon} like L{ellipsoidalKarney.LatLon} but using (exact)
|
|
54
|
+
geodesic I{wrapper} L{GeodesicSolve} to compute the geodesic distance,
|
|
55
|
+
initial and final bearing (azimuths) between two given points or the
|
|
56
|
+
destination point given a start point and an (initial) bearing.
|
|
57
|
+
'''
|
|
58
|
+
|
|
59
|
+
@Property_RO
|
|
60
|
+
def Equidistant(self):
|
|
61
|
+
'''Get the prefered azimuthal equidistant projection I{class} (L{EquidistantGeodSolve}).
|
|
62
|
+
'''
|
|
63
|
+
return _MODS.azimuthal.EquidistantGeodSolve
|
|
64
|
+
|
|
65
|
+
@Property_RO
|
|
66
|
+
def geodesicx(self):
|
|
67
|
+
'''Get this C{LatLon}'s (exact) geodesic (L{GeodesicSolve}).
|
|
68
|
+
'''
|
|
69
|
+
return self.datum.ellipsoid.geodsolve
|
|
70
|
+
|
|
71
|
+
geodesic = geodesicx # for C{._Direct} and C{._Inverse}
|
|
72
|
+
|
|
73
|
+
def toCartesian(self, **Cartesian_datum_kwds): # PYCHOK Cartesian=Cartesian, datum=None
|
|
74
|
+
'''Convert this point to exact cartesian (ECEF) coordinates.
|
|
75
|
+
|
|
76
|
+
@kwarg Cartesian_datum_kwds: Optional L{Cartesian}, B{C{datum}}
|
|
77
|
+
and other keyword arguments, ignored if C{B{Cartesian} is None}.
|
|
78
|
+
Use C{B{Cartesian}=...} to override this L{Cartesian} class
|
|
79
|
+
or set C{B{Cartesian} is None}.
|
|
80
|
+
|
|
81
|
+
@return: The cartesian (ECEF) coordinates (L{Cartesian}) or if
|
|
82
|
+
B{C{Cartesian}} is C{None}, an L{Ecef9Tuple}C{(x, y, z,
|
|
83
|
+
lat, lon, height, C, M, datum)} with C{C} and C{M} if
|
|
84
|
+
available.
|
|
85
|
+
|
|
86
|
+
@raise TypeError: Invalid B{C{Cartesian}}, B{C{datum}} or other
|
|
87
|
+
B{C{Cartesian_datum_kwds}}.
|
|
88
|
+
'''
|
|
89
|
+
kwds = _xkwds(Cartesian_datum_kwds, Cartesian=Cartesian, datum=self.datum)
|
|
90
|
+
return LatLonEllipsoidalBaseDI.toCartesian(self, **kwds)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def areaOf(points, datum=_WGS84, wrap=True):
|
|
94
|
+
'''Compute the area of an (ellipsoidal) polygon or composite.
|
|
95
|
+
|
|
96
|
+
@arg points: The polygon points (L{LatLon}[], L{BooleanFHP} or
|
|
97
|
+
L{BooleanGH}).
|
|
98
|
+
@kwarg datum: Optional datum (L{Datum}).
|
|
99
|
+
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
|
|
100
|
+
B{C{points}} (C{bool}).
|
|
101
|
+
|
|
102
|
+
@return: Area (C{meter}, same as units of the B{C{datum}}'s
|
|
103
|
+
ellipsoid axes, I{squared}).
|
|
104
|
+
|
|
105
|
+
@raise PointsError: Insufficient number of B{C{points}}.
|
|
106
|
+
|
|
107
|
+
@raise TypeError: Some B{C{points}} are not L{LatLon}.
|
|
108
|
+
|
|
109
|
+
@raise ValueError: Invalid C{B{wrap}=False}, unwrapped, unrolled
|
|
110
|
+
longitudes not supported.
|
|
111
|
+
|
|
112
|
+
@see: Functions L{pygeodesy.areaOf}, L{ellipsoidalExact.areaOf},
|
|
113
|
+
L{ellipsoidalKarney.areaOf}, L{sphericalNvector.areaOf}
|
|
114
|
+
and L{sphericalTrigonometry.areaOf}.
|
|
115
|
+
'''
|
|
116
|
+
return fabs(_polygon(datum.ellipsoid.geodsolve, points, True, False, wrap))
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def intersection3(start1, end1, start2, end2, height=None, wrap=False, # was=True
|
|
120
|
+
equidistant=None, tol=_TOL_M, LatLon=LatLon, **LatLon_kwds):
|
|
121
|
+
'''I{Iteratively} compute the intersection point of two lines, each defined
|
|
122
|
+
by two (ellipsoidal) points or by an (ellipsoidal) start point and an
|
|
123
|
+
(initial) bearing from North.
|
|
124
|
+
|
|
125
|
+
@arg start1: Start point of the first line (L{LatLon}).
|
|
126
|
+
@arg end1: End point of the first line (L{LatLon}) or the initial bearing
|
|
127
|
+
at the first point (compass C{degrees360}).
|
|
128
|
+
@arg start2: Start point of the second line (L{LatLon}).
|
|
129
|
+
@arg end2: End point of the second line (L{LatLon}) or the initial bearing
|
|
130
|
+
at the second point (compass C{degrees360}).
|
|
131
|
+
@kwarg height: Optional height at the intersection (C{meter}, conventionally)
|
|
132
|
+
or C{None} for the mean height.
|
|
133
|
+
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll the B{C{start2}}
|
|
134
|
+
and B{C{end*}} points (C{bool}).
|
|
135
|
+
@kwarg equidistant: An azimuthal equidistant projection (I{class} or function
|
|
136
|
+
L{pygeodesy.equidistant}) or C{None} for the preferred
|
|
137
|
+
C{B{start1}.Equidistant}.
|
|
138
|
+
@kwarg tol: Tolerance for convergence and for skew line distance and length
|
|
139
|
+
(C{meter}, conventionally).
|
|
140
|
+
@kwarg LatLon: Optional class to return the intersection points (L{LatLon})
|
|
141
|
+
or C{None}.
|
|
142
|
+
@kwarg LatLon_kwds: Optional, additional B{C{LatLon}} keyword arguments,
|
|
143
|
+
ignored if C{B{LatLon} is None}.
|
|
144
|
+
|
|
145
|
+
@return: An L{Intersection3Tuple}C{(point, outside1, outside2)} with C{point}
|
|
146
|
+
a B{C{LatLon}} or if C{B{LatLon} is None}, a L{LatLon4Tuple}C{(lat,
|
|
147
|
+
lon, height, datum)}.
|
|
148
|
+
|
|
149
|
+
@raise IntersectionError: Skew, colinear, parallel or otherwise
|
|
150
|
+
non-intersecting lines or no convergence
|
|
151
|
+
for the given B{C{tol}}.
|
|
152
|
+
|
|
153
|
+
@raise TypeError: Invalid or non-ellipsoidal B{C{start1}}, B{C{end1}},
|
|
154
|
+
B{C{start2}} or B{C{end2}} or invalid B{C{equidistant}}.
|
|
155
|
+
|
|
156
|
+
@note: For each line specified with an initial bearing, a pseudo-end point
|
|
157
|
+
is computed as the C{destination} along that bearing at about 1.5
|
|
158
|
+
times the distance from the start point to an initial gu-/estimate
|
|
159
|
+
of the intersection point (and between 1/8 and 3/8 of the authalic
|
|
160
|
+
earth perimeter).
|
|
161
|
+
|
|
162
|
+
@see: U{The B{ellipsoidal} case<https://GIS.StackExchange.com/questions/48937/
|
|
163
|
+
calculating-intersection-of-two-circles>} and U{Karney's paper
|
|
164
|
+
<https://ArXiv.org/pdf/1102.1215.pdf>}, pp 20-21, section B{14. MARITIME
|
|
165
|
+
BOUNDARIES} for more details about the iteration algorithm.
|
|
166
|
+
'''
|
|
167
|
+
return _intersection3(start1, end1, start2, end2, height=height, wrap=wrap,
|
|
168
|
+
equidistant=equidistant, tol=tol, LatLon=LatLon, **LatLon_kwds)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def intersections2(center1, radius1, center2, radius2, height=None, wrap=False, # was=True
|
|
172
|
+
equidistant=None, tol=_TOL_M, LatLon=LatLon, **LatLon_kwds):
|
|
173
|
+
'''I{Iteratively} compute the intersection points of two circles, each defined
|
|
174
|
+
by an (ellipsoidal) center point and a radius.
|
|
175
|
+
|
|
176
|
+
@arg center1: Center of the first circle (L{LatLon}).
|
|
177
|
+
@arg radius1: Radius of the first circle (C{meter}, conventionally).
|
|
178
|
+
@arg center2: Center of the second circle (L{LatLon}).
|
|
179
|
+
@arg radius2: Radius of the second circle (C{meter}, same units as
|
|
180
|
+
B{C{radius1}}).
|
|
181
|
+
@kwarg height: Optional height for the intersection points (C{meter},
|
|
182
|
+
conventionally) or C{None} for the I{"radical height"}
|
|
183
|
+
at the I{radical line} between both centers.
|
|
184
|
+
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll B{C{center2}}
|
|
185
|
+
(C{bool}).
|
|
186
|
+
@kwarg equidistant: An azimuthal equidistant projection (I{class} or
|
|
187
|
+
function L{pygeodesy.equidistant}) or C{None} for
|
|
188
|
+
the preferred C{B{center1}.Equidistant}.
|
|
189
|
+
@kwarg tol: Convergence tolerance (C{meter}, same units as B{C{radius1}}
|
|
190
|
+
and B{C{radius2}}).
|
|
191
|
+
@kwarg LatLon: Optional class to return the intersection points (L{LatLon})
|
|
192
|
+
or C{None}.
|
|
193
|
+
@kwarg LatLon_kwds: Optional, additional B{C{LatLon}} keyword arguments,
|
|
194
|
+
ignored if C{B{LatLon} is None}.
|
|
195
|
+
|
|
196
|
+
@return: 2-Tuple of the intersection points, each a B{C{LatLon}} instance
|
|
197
|
+
or L{LatLon4Tuple}C{(lat, lon, height, datum)} if C{B{LatLon} is
|
|
198
|
+
None}. For abutting circles, both points are the same instance,
|
|
199
|
+
aka the I{radical center}.
|
|
200
|
+
|
|
201
|
+
@raise IntersectionError: Concentric, antipodal, invalid or non-intersecting
|
|
202
|
+
circles or no convergence for the B{C{tol}}.
|
|
203
|
+
|
|
204
|
+
@raise TypeError: Invalid or non-ellipsoidal B{C{center1}} or B{C{center2}}
|
|
205
|
+
or invalid B{C{equidistant}}.
|
|
206
|
+
|
|
207
|
+
@raise UnitError: Invalid B{C{radius1}}, B{C{radius2}} or B{C{height}}.
|
|
208
|
+
|
|
209
|
+
@see: U{The B{ellipsoidal} case<https://GIS.StackExchange.com/questions/48937/
|
|
210
|
+
calculating-intersection-of-two-circles>}, U{Karney's paper
|
|
211
|
+
<https://ArXiv.org/pdf/1102.1215.pdf>}, pp 20-21, section B{14. MARITIME BOUNDARIES},
|
|
212
|
+
U{Circle-Circle<https://MathWorld.Wolfram.com/Circle-CircleIntersection.html>} and
|
|
213
|
+
U{Sphere-Sphere<https://MathWorld.Wolfram.com/Sphere-SphereIntersection.html>}
|
|
214
|
+
intersections.
|
|
215
|
+
'''
|
|
216
|
+
return _intersections2(center1, radius1, center2, radius2, height=height, wrap=wrap,
|
|
217
|
+
equidistant=equidistant, tol=tol, LatLon=LatLon, **LatLon_kwds)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def isclockwise(points, datum=_WGS84, wrap=True):
|
|
221
|
+
'''Determine the direction of a path or polygon.
|
|
222
|
+
|
|
223
|
+
@arg points: The path or polygon points (C{LatLon}[]).
|
|
224
|
+
@kwarg datum: Optional datum (L{Datum}).
|
|
225
|
+
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
|
|
226
|
+
B{C{points}} (C{bool}).
|
|
227
|
+
|
|
228
|
+
@return: C{True} if B{C{points}} are clockwise, C{False} otherwise.
|
|
229
|
+
|
|
230
|
+
@raise PointsError: Insufficient number of B{C{points}}.
|
|
231
|
+
|
|
232
|
+
@raise TypeError: Some B{C{points}} are not C{LatLon}.
|
|
233
|
+
|
|
234
|
+
@raise ValueError: The B{C{points}} enclose a pole or zero
|
|
235
|
+
area.
|
|
236
|
+
|
|
237
|
+
@see: L{pygeodesy.isclockwise}.
|
|
238
|
+
'''
|
|
239
|
+
a = _polygon(datum.ellipsoid.geodsolve, points, True, False, wrap)
|
|
240
|
+
if a < 0:
|
|
241
|
+
return True
|
|
242
|
+
elif a > 0:
|
|
243
|
+
return False
|
|
244
|
+
raise _areaError(points)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def nearestOn(point, point1, point2, within=True, height=None, wrap=False,
|
|
248
|
+
equidistant=None, tol=_TOL_M, LatLon=LatLon, **LatLon_kwds):
|
|
249
|
+
'''I{Iteratively} locate the closest point on the geodesic between
|
|
250
|
+
two other (ellipsoidal) points.
|
|
251
|
+
|
|
252
|
+
@arg point: Reference point (C{LatLon}).
|
|
253
|
+
@arg point1: Start point of the geodesic (C{LatLon}).
|
|
254
|
+
@arg point2: End point of the geodesic (C{LatLon}).
|
|
255
|
+
@kwarg within: If C{True} return the closest point I{between}
|
|
256
|
+
B{C{point1}} and B{C{point2}}, otherwise the
|
|
257
|
+
closest point elsewhere on the geodesic (C{bool}).
|
|
258
|
+
@kwarg height: Optional height for the closest point (C{meter},
|
|
259
|
+
conventionally) or C{None} or C{False} for the
|
|
260
|
+
interpolated height. If C{False}, the closest
|
|
261
|
+
takes the heights of the points into account.
|
|
262
|
+
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll both
|
|
263
|
+
B{C{point1}} and B{C{point2}} (C{bool}).
|
|
264
|
+
@kwarg equidistant: An azimuthal equidistant projection (I{class}
|
|
265
|
+
or function L{pygeodesy.equidistant}) or C{None}
|
|
266
|
+
for the preferred C{B{point}.Equidistant}.
|
|
267
|
+
@kwarg tol: Convergence tolerance (C{meter}).
|
|
268
|
+
@kwarg LatLon: Optional class to return the closest point
|
|
269
|
+
(L{LatLon}) or C{None}.
|
|
270
|
+
@kwarg LatLon_kwds: Optional, additional B{C{LatLon}} keyword
|
|
271
|
+
arguments, ignored if C{B{LatLon} is None}.
|
|
272
|
+
|
|
273
|
+
@return: Closest point, a B{C{LatLon}} instance or if C{B{LatLon}
|
|
274
|
+
is None}, a L{LatLon4Tuple}C{(lat, lon, height, datum)}.
|
|
275
|
+
|
|
276
|
+
@raise TypeError: Invalid or non-ellipsoidal B{C{point}}, B{C{point1}}
|
|
277
|
+
or B{C{point2}} or invalid B{C{equidistant}}.
|
|
278
|
+
|
|
279
|
+
@raise ValueError: No convergence for the B{C{tol}}.
|
|
280
|
+
|
|
281
|
+
@see: U{The B{ellipsoidal} case<https://GIS.StackExchange.com/questions/48937/
|
|
282
|
+
calculating-intersection-of-two-circles>} and U{Karney's paper
|
|
283
|
+
<https://ArXiv.org/pdf/1102.1215.pdf>}, pp 20-21, section B{14. MARITIME
|
|
284
|
+
BOUNDARIES} for more details about the iteration algorithm.
|
|
285
|
+
'''
|
|
286
|
+
return _nearestOn(point, point1, point2, within=within, height=height, wrap=wrap,
|
|
287
|
+
equidistant=equidistant, tol=tol, LatLon=LatLon, **LatLon_kwds)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def perimeterOf(points, closed=False, datum=_WGS84, wrap=True):
|
|
291
|
+
'''Compute the perimeter of an (ellipsoidal) polygon or composite.
|
|
292
|
+
|
|
293
|
+
@arg points: The polygon points (L{LatLon}[], L{BooleanFHP} or
|
|
294
|
+
L{BooleanGH}).
|
|
295
|
+
@kwarg closed: Optionally, close the polygon (C{bool}).
|
|
296
|
+
@kwarg datum: Optional datum (L{Datum}).
|
|
297
|
+
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
|
|
298
|
+
B{C{points}} (C{bool}).
|
|
299
|
+
|
|
300
|
+
@return: Perimeter (C{meter}, same as units of the B{C{datum}}'s
|
|
301
|
+
ellipsoid axes).
|
|
302
|
+
|
|
303
|
+
@raise PointsError: Insufficient number of B{C{points}}.
|
|
304
|
+
|
|
305
|
+
@raise TypeError: Some B{C{points}} are not L{LatLon}.
|
|
306
|
+
|
|
307
|
+
@raise ValueError: Invalid C{B{wrap}=False}, unwrapped, unrolled
|
|
308
|
+
longitudes not supported or C{B{closed}=False}
|
|
309
|
+
with C{B{points}} a composite.
|
|
310
|
+
|
|
311
|
+
@see: Functions L{pygeodesy.perimeterOf}, L{ellipsoidalExact.perimeterOf},
|
|
312
|
+
L{ellipsoidalKarney.perimeterOf}, L{sphericalNvector.perimeterOf}
|
|
313
|
+
and L{sphericalTrigonometry.perimeterOf}.
|
|
314
|
+
'''
|
|
315
|
+
return _polygon(datum.ellipsoid.geodsolve, points, closed, True, wrap)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
__all__ += _ALL_OTHER(Cartesian, LatLon, # classes
|
|
319
|
+
areaOf, # functions
|
|
320
|
+
intersection3, intersections2, isclockwise, ispolar,
|
|
321
|
+
nearestOn, perimeterOf)
|
|
322
|
+
|
|
323
|
+
# **) MIT License
|
|
324
|
+
#
|
|
325
|
+
# Copyright (C) 2016-2024 -- mrJean1 at Gmail -- All Rights Reserved.
|
|
326
|
+
#
|
|
327
|
+
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
328
|
+
# copy of this software and associated documentation files (the "Software"),
|
|
329
|
+
# to deal in the Software without restriction, including without limitation
|
|
330
|
+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
331
|
+
# and/or sell copies of the Software, and to permit persons to whom the
|
|
332
|
+
# Software is furnished to do so, subject to the following conditions:
|
|
333
|
+
#
|
|
334
|
+
# The above copyright notice and this permission notice shall be included
|
|
335
|
+
# in all copies or substantial portions of the Software.
|
|
336
|
+
#
|
|
337
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
338
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
339
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
340
|
+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
341
|
+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
342
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
343
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|