pygeodesy 25.5.25__py2.py3-none-any.whl → 25.7.25__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.
@@ -24,7 +24,7 @@ from pygeodesy.points import _areaError, ispolar # PYCHOK exported
24
24
  # from math import fabs # from .karney
25
25
 
26
26
  __all__ = _ALL_LAZY.ellipsoidalGeodSolve
27
- __version__ = '24.08.13'
27
+ __version__ = '25.05.28'
28
28
 
29
29
 
30
30
  class Cartesian(CartesianEllipsoidalBase):
@@ -87,12 +87,16 @@ class LatLon(LatLonEllipsoidalBaseDI):
87
87
  return LatLonEllipsoidalBaseDI.toCartesian(self, **kwds)
88
88
 
89
89
 
90
- def areaOf(points, datum=_WGS84, wrap=True):
90
+ def areaOf(points, datum=_WGS84, wrap=True, polar=False):
91
91
  '''Compute the area of an (ellipsoidal) polygon or composite.
92
92
 
93
93
  @arg points: The polygon points (L{LatLon}[], L{BooleanFHP} or L{BooleanGH}).
94
94
  @kwarg datum: Optional datum (L{Datum}).
95
95
  @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the B{C{points}} (C{bool}).
96
+ @kwarg polar: Use C{B{polar}=True} if the polygon encloses a pole (C{bool}), see
97
+ function L{ispolar<pygeodesy.points.ispolar>} and U{area of a polygon
98
+ enclosing a pole<https://GeographicLib.SourceForge.io/C++/doc/
99
+ classGeographicLib_1_1GeodesicExact.html#a3d7a9155e838a09a48dc14d0c3fac525>}.
96
100
 
97
101
  @return: Area (C{meter}, same as units of the B{C{datum}}'s ellipsoid axes, I{squared}).
98
102
 
@@ -105,7 +109,7 @@ def areaOf(points, datum=_WGS84, wrap=True):
105
109
  @see: Functions L{pygeodesy.areaOf}, L{ellipsoidalExact.areaOf}, L{ellipsoidalKarney.areaOf},
106
110
  L{sphericalNvector.areaOf} and L{sphericalTrigonometry.areaOf}.
107
111
  '''
108
- return fabs(_polygon(datum.ellipsoid.geodsolve, points, True, False, wrap))
112
+ return fabs(_polygon(datum.ellipsoid.geodsolve, points, True, False, wrap, polar))
109
113
 
110
114
 
111
115
  def intersection3(start1, end1, start2, end2, height=None, wrap=False, # was=True
@@ -209,13 +213,14 @@ def intersections2(center1, radius1, center2, radius2, height=None, wrap=False,
209
213
  equidistant=equidistant, tol=tol, LatLon=LatLon, **LatLon_kwds)
210
214
 
211
215
 
212
- def isclockwise(points, datum=_WGS84, wrap=True):
216
+ def isclockwise(points, datum=_WGS84, wrap=True, polar=False):
213
217
  '''Determine the direction of a path or polygon.
214
218
 
215
219
  @arg points: The path or polygon points (C{LatLon}[]).
216
220
  @kwarg datum: Optional datum (L{Datum}).
217
- @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
218
- B{C{points}} (C{bool}).
221
+ @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the B{C{points}} (C{bool}).
222
+ @kwarg polar: Use C{B{polar}=True} if the C{B{points}} enclose a pole (C{bool}),
223
+ see function U{ispolar<pygeodeys.points.ispolar>}.
219
224
 
220
225
  @return: C{True} if B{C{points}} are clockwise, C{False} otherwise.
221
226
 
@@ -223,12 +228,11 @@ def isclockwise(points, datum=_WGS84, wrap=True):
223
228
 
224
229
  @raise TypeError: Some B{C{points}} are not C{LatLon}.
225
230
 
226
- @raise ValueError: The B{C{points}} enclose a pole or zero
227
- area.
231
+ @raise ValueError: The B{C{points}} enclose a pole or zero area.
228
232
 
229
233
  @see: L{pygeodesy.isclockwise}.
230
234
  '''
231
- a = _polygon(datum.ellipsoid.geodsolve, points, True, False, wrap)
235
+ a = _polygon(datum.ellipsoid.geodsolve, points, True, False, wrap, polar)
232
236
  if a < 0:
233
237
  return True
234
238
  elif a > 0:
@@ -282,29 +286,25 @@ def nearestOn(point, point1, point2, within=True, height=None, wrap=False,
282
286
  def perimeterOf(points, closed=False, datum=_WGS84, wrap=True):
283
287
  '''Compute the perimeter of an (ellipsoidal) polygon or composite.
284
288
 
285
- @arg points: The polygon points (L{LatLon}[], L{BooleanFHP} or
286
- L{BooleanGH}).
289
+ @arg points: The polygon points (L{LatLon}[], L{BooleanFHP} or L{BooleanGH}).
287
290
  @kwarg closed: Optionally, close the polygon (C{bool}).
288
291
  @kwarg datum: Optional datum (L{Datum}).
289
- @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
290
- B{C{points}} (C{bool}).
292
+ @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the B{C{points}} (C{bool}).
291
293
 
292
- @return: Perimeter (C{meter}, same as units of the B{C{datum}}'s
293
- ellipsoid axes).
294
+ @return: Perimeter (C{meter}, same as units of the B{C{datum}}'s ellipsoid axes).
294
295
 
295
296
  @raise PointsError: Insufficient number of B{C{points}}.
296
297
 
297
298
  @raise TypeError: Some B{C{points}} are not L{LatLon}.
298
299
 
299
- @raise ValueError: Invalid C{B{wrap}=False}, unwrapped, unrolled
300
- longitudes not supported or C{B{closed}=False}
301
- with C{B{points}} a composite.
300
+ @raise ValueError: Invalid C{B{wrap}=False}, unwrapped, unrolled longitudes not
301
+ supported or C{B{closed}=False} with C{B{points}} a composite.
302
302
 
303
303
  @see: Functions L{pygeodesy.perimeterOf}, L{ellipsoidalExact.perimeterOf},
304
304
  L{ellipsoidalKarney.perimeterOf}, L{sphericalNvector.perimeterOf}
305
305
  and L{sphericalTrigonometry.perimeterOf}.
306
306
  '''
307
- return _polygon(datum.ellipsoid.geodsolve, points, closed, True, wrap)
307
+ return _polygon(datum.ellipsoid.geodsolve, points, closed, True, wrap, False)
308
308
 
309
309
 
310
310
  __all__ += _ALL_OTHER(Cartesian, LatLon, # classes
@@ -42,7 +42,7 @@ from pygeodesy.props import deprecated_method, Property_RO
42
42
  # from math import fabs # from .karney
43
43
 
44
44
  __all__ = _ALL_LAZY.ellipsoidalKarney
45
- __version__ = '24.08.13'
45
+ __version__ = '25.05.27'
46
46
 
47
47
 
48
48
  class Cartesian(CartesianEllipsoidalBase):
@@ -110,13 +110,17 @@ class LatLon(LatLonEllipsoidalBaseDI):
110
110
  return LatLonEllipsoidalBaseDI.toCartesian(self, **kwds)
111
111
 
112
112
 
113
- def areaOf(points, datum=_WGS84, wrap=True):
113
+ def areaOf(points, datum=_WGS84, wrap=True, polar=False):
114
114
  '''Compute the area of an (ellipsoidal) polygon or composite using I{Karney}'s
115
115
  U{geographiclib<https://PyPI.org/project/geographiclib>} package.
116
116
 
117
117
  @arg points: The polygon points (L{LatLon}[], L{BooleanFHP} or L{BooleanGH}).
118
118
  @kwarg datum: Optional datum (L{Datum}).
119
119
  @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the B{C{points}} (C{bool}).
120
+ @kwarg polar: Use C{B{polar}=True} if the polygon encloses a pole (C{bool}), see
121
+ function L{ispolar<pygeodesy.points.ispolar>} and U{area of a polygon
122
+ enclosing a pole<https://GeographicLib.SourceForge.io/C++/doc/
123
+ classGeographicLib_1_1GeodesicExact.html#a3d7a9155e838a09a48dc14d0c3fac525>}.
120
124
 
121
125
  @return: Area (C{meter}, same as units of the B{C{datum}}'s ellipsoid axes, I{squared}).
122
126
 
@@ -131,12 +135,8 @@ def areaOf(points, datum=_WGS84, wrap=True):
131
135
 
132
136
  @see: Functions L{pygeodesy.areaOf}, L{ellipsoidalExact.areaOf}, L{ellipsoidalGeodSolve.areaOf},
133
137
  L{sphericalNvector.areaOf} and L{sphericalTrigonometry.areaOf}.
134
-
135
- @note: The U{area of a polygon enclosing a pole<https://GeographicLib.SourceForge.io/
136
- C++/doc/classGeographicLib_1_1GeodesicExact.html#a3d7a9155e838a09a48dc14d0c3fac525>}
137
- can be found by adding half the datum's ellipsoid surface area to the polygon's area.
138
138
  '''
139
- return fabs(_polygon(datum.ellipsoid.geodesic, points, True, False, wrap))
139
+ return fabs(_polygon(datum.ellipsoid.geodesic, points, True, False, wrap, polar))
140
140
 
141
141
 
142
142
  def intersection3(start1, end1, start2, end2, height=None, wrap=False, # was=True
@@ -240,19 +240,19 @@ def intersections2(center1, radius1, center2, radius2, height=None, wrap=False,
240
240
  equidistant=equidistant, tol=tol, LatLon=LatLon, **LatLon_kwds)
241
241
 
242
242
 
243
- def isclockwise(points, datum=_WGS84, wrap=True):
243
+ def isclockwise(points, datum=_WGS84, wrap=True, polar=False):
244
244
  '''Determine the direction of a path or polygon using I{Karney}'s
245
245
  U{geographiclib<https://PyPI.org/project/geographiclib>} package.
246
246
 
247
247
  @arg points: The path or polygon points (C{LatLon}[]).
248
248
  @kwarg datum: Optional datum (L{Datum}).
249
- @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
250
- B{C{points}} (C{bool}).
249
+ @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the B{C{points}} (C{bool}).
250
+ @kwarg polar: Use C{B{polar}=True} if the C{B{points}} enclose a pole (C{bool}),
251
+ see function U{ispolar<pygeodeys.points.ispolar>}.
251
252
 
252
253
  @return: C{True} if B{C{points}} are clockwise, C{False} otherwise.
253
254
 
254
- @raise ImportError: Package U{geographiclib
255
- <https://PyPI.org/project/geographiclib>}
255
+ @raise ImportError: Package U{geographiclib<https://PyPI.org/project/geographiclib>}
256
256
  not installed or not found.
257
257
 
258
258
  @raise PointsError: Insufficient number of B{C{points}}.
@@ -263,7 +263,7 @@ def isclockwise(points, datum=_WGS84, wrap=True):
263
263
 
264
264
  @see: L{pygeodesy.isclockwise}.
265
265
  '''
266
- a = _polygon(datum.ellipsoid.geodesic, points, True, False, wrap)
266
+ a = _polygon(datum.ellipsoid.geodesic, points, True, False, wrap, polar)
267
267
  if a < 0:
268
268
  return True
269
269
  elif a > 0:
@@ -322,34 +322,29 @@ def perimeterOf(points, closed=False, datum=_WGS84, wrap=True):
322
322
  '''Compute the perimeter of an (ellipsoidal) polygon or composite using I{Karney}'s
323
323
  U{geographiclib<https://PyPI.org/project/geographiclib>} package.
324
324
 
325
- @arg points: The polygon points (L{LatLon}[], L{BooleanFHP} or
326
- L{BooleanGH}).
325
+ @arg points: The polygon points (L{LatLon}[], L{BooleanFHP} or L{BooleanGH}).
327
326
  @kwarg closed: Optionally, close the polygon (C{bool}).
328
327
  @kwarg datum: Optional datum (L{Datum}).
329
- @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
330
- B{C{points}} (C{bool}).
328
+ @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the B{C{points}} (C{bool}).
331
329
 
332
- @return: Perimeter (C{meter}, same as units of the B{C{datum}}'s
333
- ellipsoid axes).
330
+ @return: Perimeter (C{meter}, same as units of the B{C{datum}}'s ellipsoid axes).
334
331
 
335
- @raise ImportError: Package U{geographiclib
336
- <https://PyPI.org/project/geographiclib>}
332
+ @raise ImportError: Package U{geographiclib<https://PyPI.org/project/geographiclib>}
337
333
  not installed or not found.
338
334
 
339
335
  @raise PointsError: Insufficient number of B{C{points}}.
340
336
 
341
- @raise TypeError: Some B{C{points}} are not L{LatLon} or C{B{closed}=False}
342
- with B{C{points}} a composite.
337
+ @raise TypeError: Some B{C{points}} are not L{LatLon} or C{B{closed}=False} with
338
+ B{C{points}} a composite.
343
339
 
344
- @raise ValueError: Invalid C{B{wrap}=False}, unwrapped, unrolled
345
- longitudes not supported or C{B{closed}=False}
346
- with C{B{points}} a composite.
340
+ @raise ValueError: Invalid C{B{wrap}=False}, unwrapped, unrolled longitudes not
341
+ supported or C{B{closed}=False} with C{B{points}} a composite.
347
342
 
348
343
  @see: Functions L{pygeodesy.perimeterOf}, L{ellipsoidalExact.perimeterOf},
349
344
  L{ellipsoidalGeodSolve.perimeterOf}, L{sphericalNvector.perimeterOf}
350
345
  and L{sphericalTrigonometry.perimeterOf}.
351
346
  '''
352
- return _polygon(datum.ellipsoid.geodesic, points, closed, True, wrap)
347
+ return _polygon(datum.ellipsoid.geodesic, points, closed, True, wrap, False)
353
348
 
354
349
 
355
350
  __all__ += _ALL_OTHER(Cartesian, LatLon, # classes
@@ -76,7 +76,7 @@ from pygeodesy.utily import atan2, atan2b, atan2d, sincos2, sincos2d, \
76
76
  from math import cos, degrees, fabs, radians, tan as _tan
77
77
 
78
78
  __all__ = _ALL_LAZY.ellipsoidalVincenty
79
- __version__ = '25.05.23'
79
+ __version__ = '25.05.26'
80
80
 
81
81
  _antipodal_to_ = _SPACE_(_antipodal_, _to_)
82
82
 
@@ -349,13 +349,6 @@ def _c2sm2(c2sm):
349
349
  return c2sm**2 * _2_0 - _1_0
350
350
 
351
351
 
352
- def _ellipsoidal(): # helper for areaOf and perimeterOf
353
- try:
354
- return _MODS.ellipsoidalKarney
355
- except ImportError:
356
- return _MODS.ellipsoidalExact
357
-
358
-
359
352
  def _Dl(f, ca2, sa, s, cs, ss, c2sm, dl=_0_0):
360
353
  # C{Dl}
361
354
  if f and sa:
@@ -385,6 +378,14 @@ def _Ecef():
385
378
  return E
386
379
 
387
380
 
381
+ def _ellipsoidalOf(_Of, points, **kwds): # helper for DEPRECATED areaOf and perimeterOf
382
+ try:
383
+ r = getattr(_MODS.ellipsoidalKarney, _Of.__name__)(points, **kwds)
384
+ except ImportError: # no geographiclib
385
+ r = getattr(_MODS.ellipsoidalExact, _Of.__name__)(points, **kwds)
386
+ return r
387
+
388
+
388
389
  def _sincos22(sa):
389
390
  # 2-Tuple C{(sin(a), cos(a)**2)}
390
391
  ca2 = _1_0 - sa**2
@@ -403,10 +404,10 @@ def _sincostan3r(a, f):
403
404
 
404
405
 
405
406
  @deprecated_function
406
- def areaOf(points, **datum_wrap):
407
+ def areaOf(points, **datum_wrap_polar):
407
408
  '''DEPRECATED, use function L{ellipsoidalExact.areaOf} or L{ellipsoidalKarney.areaOf}.
408
409
  '''
409
- return _ellipsoidal().areaOf(points, **datum_wrap)
410
+ return _ellipsoidalOf(areaOf, points, **datum_wrap_polar)
410
411
 
411
412
 
412
413
  def intersection3(start1, end1, start2, end2, height=None, wrap=False, # was=True
@@ -562,7 +563,7 @@ def nearestOn(point, point1, point2, within=True, height=None, wrap=False,
562
563
  def perimeterOf(points, **closed_datum_wrap):
563
564
  '''DEPRECATED, use function L{ellipsoidalExact.perimeterOf} or L{ellipsoidalKarney.perimeterOf}.
564
565
  '''
565
- return _ellipsoidal().perimeterOf(points, **closed_datum_wrap)
566
+ return _ellipsoidalOf(perimeterOf, points, **closed_datum_wrap)
566
567
 
567
568
 
568
569
  __all__ += _ALL_DOCS(Cartesian, LatLon, intersecant2, # from .ellipsoidalBaseDI