Coverage for pygeodesy/ellipsoidalBase.py: 94%
288 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-09-20 13:43 -0400
« prev ^ index » next coverage.py v7.2.2, created at 2023-09-20 13:43 -0400
2# -*- coding: utf-8 -*-
4u'''(INTERNAL) Private ellipsoidal base classes C{CartesianEllipsoidalBase}
5and C{LatLonEllipsoidalBase}.
7A pure Python implementation of geodesy tools for ellipsoidal earth models,
8transcoded in part from JavaScript originals by I{(C) Chris Veness 2005-2016}
9and published under the same MIT Licence**, see for example U{latlon-ellipsoidal
10<https://www.Movable-Type.co.UK/scripts/geodesy/docs/latlon-ellipsoidal.js.html>}.
11'''
12# make sure int/int division yields float quotient, see .basics
13from __future__ import division as _; del _ # PYCHOK semicolon
15# from pygeodesy.basics import _xinstanceof # from .datums
16from pygeodesy.constants import EPS, EPS0, EPS1, _0_0, _0_5
17from pygeodesy.cartesianBase import CartesianBase, _ellipsoidal_ # PYCHOK used!
18from pygeodesy.datums import Datum, Datums, _ellipsoidal_datum, \
19 _spherical_datum, _WGS84, _xinstanceof
20from pygeodesy.errors import _incompatible, _IsnotError, RangeError, TRFError, \
21 _ValueError, _xattr, _xellipsoidal, _xError, \
22 _xkwds, _xkwds_get, _xkwds_not
23# from pygeodesy.interns import _ellipsoidal_ # from .cartesianBase
24from pygeodesy.interns import MISSING, NN, _COMMA_, _conversion_, _DOT_, _no_, \
25 _reframe_, _SPACE_
26from pygeodesy.latlonBase import LatLonBase, _trilaterate5, \
27 fabs, Vector3Tuple, _Wrap
28from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
29# from pygeodesy.lcc import toLcc # _MODS
30# from pygeodesy.named import notOverloaded # _MODS
31# from pygeodesy.namedTuples import Vector3Tuple # from .latlonBase
32from pygeodesy.props import deprecated_method, deprecated_property_RO, \
33 Property_RO, property_doc_, property_RO, _update_all
34from pygeodesy.units import Epoch, _1mm as _TOL_M, Radius_
35# from pygeodesy.utily import _Wrap # from .latlonBase
37# from math import fabs # from .latlonBase
39__all__ = _ALL_LAZY.ellipsoidalBase
40__version__ = '23.09.09'
43class CartesianEllipsoidalBase(CartesianBase):
44 '''(INTERNAL) Base class for ellipsoidal C{Cartesian}s.
45 '''
46 _datum = _WGS84 # L{Datum}
47 _reframe = None
49# def __matmul__(self, other): # PYCHOK Python 3.5+
50# '''Return C{NotImplemented} for C{c_ = c @ datum}, C{c_ = c @ reframe} and C{c_ = c @ Transform}.
51# '''
52# RefFrame = _MODS.trf.RefFrame
53# return NotImplemented if isinstance(other, (Datum, RefFrame, Transform)) else \
54# _NotImplemented(self, other)
56 @deprecated_method
57 def convertRefFrame(self, reframe2, reframe, epoch=None):
58 '''DEPRECATED, use method L{toRefFrame}.'''
59 return self.toRefFrame(reframe2, reframe, epoch=epoch)
61 def intersections2(self, radius, center2, radius2, sphere=True,
62 Vector=None, **Vector_kwds):
63 '''Compute the intersection of two spheres or circles, each defined by a
64 cartesian center point and a radius.
66 @arg radius: Radius of this sphere or circle (same units as this point's
67 coordinates).
68 @arg center2: Center of the second sphere or circle (C{Cartesian}, L{Vector3d},
69 C{Vector3Tuple} or C{Vector4Tuple}).
70 @arg radius2: Radius of the second sphere or circle (same units as this and
71 the B{C{other}} point's coordinates).
72 @kwarg sphere: If C{True} compute the center and radius of the intersection
73 of two I{spheres}. If C{False}, ignore the C{z}-component and
74 compute the intersection of two I{circles} (C{bool}).
75 @kwarg Vector: Class to return intersections (C{Cartesian}, L{Vector3d} or
76 C{Vector3Tuple}) or C{None} for an instance of this (sub-)class.
77 @kwarg Vector_kwds: Optional, additional B{C{Vector}} keyword arguments,
78 ignored if C{B{Vector} is None}.
80 @return: If B{C{sphere}} is C{True}, a 2-tuple of the C{center} and C{radius}
81 of the intersection of the I{spheres}. The C{radius} is C{0.0} for
82 abutting spheres (and the C{center} is aka the I{radical center}).
84 If B{C{sphere}} is C{False}, a 2-tuple with the two intersection
85 points of the I{circles}. For abutting circles, both points are
86 the same instance, aka the I{radical center}.
88 @raise IntersectionError: Concentric, invalid or non-intersecting spheres or circles.
90 @raise TypeError: Invalid B{C{center2}}.
92 @raise UnitError: Invalid B{C{radius}} or B{C{radius2}}.
94 @see: U{Sphere-Sphere<https://MathWorld.Wolfram.com/Sphere-SphereIntersection.html>},
95 U{Circle-Circle<https://MathWorld.Wolfram.com/Circle-CircleIntersection.html>}
96 Intersection and function L{pygeodesy.radical2}.
97 '''
98 try:
99 return _MODS.vector3d._intersects2(self, Radius_(radius=radius),
100 center2, Radius_(radius2=radius2),
101 sphere=sphere, clas=self.classof,
102 Vector=Vector, **Vector_kwds)
103 except (TypeError, ValueError) as x:
104 raise _xError(x, center=self, radius=radius, center2=center2, radius2=radius2)
106 @property_doc_(''' this cartesian's reference frame (L{RefFrame}).''')
107 def reframe(self):
108 '''Get this cartesian's reference frame (L{RefFrame}) or C{None}.
109 '''
110 return self._reframe
112 @reframe.setter # PYCHOK setter!
113 def reframe(self, reframe):
114 '''Set or clear this cartesian's reference frame (L{RefFrame}) or C{None}.
116 @raise TypeError: The B{C{reframe}} is not a L{RefFrame}.
117 '''
118 _set_reframe(self, reframe)
120 def toRefFrame(self, reframe2, reframe=None, epoch=None):
121 '''Convert this cartesian point from one to an other reference frame.
123 @arg reframe2: Reference frame to convert I{to} (L{RefFrame}).
124 @arg reframe: Reference frame to convert I{from} (L{RefFrame}),
125 overriding this cartesian's C{reframe}.
126 @kwarg epoch: Optional epoch to observe (C{scalar}, fractional
127 calendar year), overriding B{C{reframe}}'s epoch.
129 @return: The converted point (C{Cartesian}) or this point if
130 conversion is C{nil}.
132 @raise TRFError: No conversion available from B{C{reframe}}
133 to B{C{reframe2}} or invalid B{C{epoch}}.
135 @raise TypeError: B{C{reframe2}} or B{C{reframe}} not a
136 L{RefFrame}.
137 '''
138 r = self.reframe if reframe is None else reframe
139 if r in (None, reframe2):
140 xs = None # XXX _set_reframe(self, reframe2)?
141 else:
142 trf = _MODS.trf
143 _xinstanceof(trf.RefFrame, reframe2=reframe2, reframe=r)
144 _, xs = trf._reframeTransforms2(reframe2, r, epoch)
145 return self.toTransforms_(*xs) if xs else self
147 def toTransforms_(self, *transforms, **datum):
148 '''Apply none, one or several Helmert transforms.
150 @arg transforms: Transforms to apply, in order (L{Transform}s).
151 @kwarg datum: Datum for the transformed point (L{Datum}),
152 overriding this point's datum.
154 @return: The transformed point (C{Cartesian}) or this point
155 if the B{C{transforms}} produce the same point.
156 '''
157 r = self
158 if transforms:
159 xyz = r.xyz
160 for t in transforms:
161 xyz = t.transform(*xyz)
162 d = _xkwds_get(datum, datum=r.datum)
163 if d != r.datum or xyz != r.xyz:
164 r = r.classof(xyz, datum=d)
165 return r
168class LatLonEllipsoidalBase(LatLonBase):
169 '''(INTERNAL) Base class for ellipsoidal C{LatLon}s.
170 '''
171 _datum = _WGS84 # L{Datum}
172 _elevation2to = None # _elevation2 timeout (C{secs})
173 _epoch = None # overriding .reframe.epoch (C{float})
174 _gamma = None # UTM/UPS meridian convergence (C{degrees})
175 _geoidHeight2to = None # _geoidHeight2 timeout (C{secs})
176 _reframe = None # reference frame (L{RefFrame})
177 _scale = None # UTM/UPS scale factor (C{float})
178 _toLLEB_args = () # Etm/Utm/Ups._toLLEB arguments
180 def __init__(self, latlonh, lon=None, height=0, datum=None, reframe=None,
181 epoch=None, wrap=False, name=NN):
182 '''Create an ellipsoidal C{LatLon} point frome the given
183 lat-, longitude and height on the given datum and with
184 the given reference frame and epoch.
186 @arg latlonh: Latitude (C{degrees} or DMS C{str} with N or S suffix) or
187 a previous C{LatLon} instance provided C{B{lon}=None}.
188 @kwarg lon: Longitude (C{degrees} or DMS C{str} with E or W suffix) or
189 C(None), indicating B{C{latlonh}} is a C{LatLon}.
190 @kwarg height: Optional height above (or below) the earth surface
191 (C{meter}, same units as the datum's ellipsoid axes).
192 @kwarg datum: Optional, ellipsoidal datum to use (L{Datum}, L{Ellipsoid},
193 L{Ellipsoid2} or L{a_f2Tuple}).
194 @kwarg reframe: Optional reference frame (L{RefFrame}).
195 @kwarg epoch: Optional epoch to observe for B{C{reframe}} (C{scalar}),
196 a non-zero, fractional calendar year; silently ignored
197 if C{B{reframe}=None}.
198 @kwarg wrap: If C{True}, wrap or I{normalize} B{C{lat}} and B{C{lon}}
199 (C{bool}).
200 @kwarg name: Optional name (string).
202 @raise RangeError: Value of C{lat} or B{C{lon}} outside the valid
203 range and L{rangerrors} set to C{True}.
205 @raise TypeError: If B{C{latlonh}} is not a C{LatLon}, B{C{datum}} is
206 not a L{Datum}, B{C{reframe}} is not a L{RefFrame}
207 or B{C{epoch}} is not C{scalar} non-zero.
209 @raise UnitError: Invalid B{C{lat}}, B{C{lon}} or B{C{height}}.
211 @example:
213 >>> p = LatLon(51.4778, -0.0016) # height=0, datum=Datums.WGS84
214 '''
215 LatLonBase.__init__(self, latlonh, lon=lon, height=height, wrap=wrap, name=name)
216 if datum not in (None, self._datum):
217 self.datum = _ellipsoidal_datum(datum, name=name)
218 if reframe:
219 self.reframe = reframe
220 self.epoch = epoch
222# def __matmul__(self, other): # PYCHOK Python 3.5+
223# '''Return C{NotImplemented} for C{ll_ = ll @ datum} and C{ll_ = ll @ reframe}.
224# '''
225# RefFrame = _MODS.trf.RefFrame
226# return NotImplemented if isinstance(other, (Datum, RefFrame)) else \
227# _NotImplemented(self, other)
229 def antipode(self, height=None):
230 '''Return the antipode, the point diametrically opposite
231 to this point.
233 @kwarg height: Optional height of the antipode, height
234 of this point otherwise (C{meter}).
236 @return: The antipodal point (C{LatLon}).
237 '''
238 lla = LatLonBase.antipode(self, height=height)
239 if lla.datum != self.datum:
240 lla.datum = self.datum
241 return lla
243 @deprecated_property_RO
244 def convergence(self):
245 '''DEPRECATED, use property C{gamma}.'''
246 return self.gamma
248 @deprecated_method
249 def convertDatum(self, datum2):
250 '''DEPRECATED, use method L{toDatum}.'''
251 return self.toDatum(datum2)
253 @deprecated_method
254 def convertRefFrame(self, reframe2):
255 '''DEPRECATED, use method L{toRefFrame}.'''
256 return self.toRefFrame(reframe2)
258 @Property_RO
259 def _css(self):
260 '''(INTERNAL) Get this C{LatLon} point as a Cassini-Soldner location (L{Css}).
261 '''
262 css = _MODS.css
263 return css.toCss(self, height=self.height, Css=css.Css, name=self.name)
265 @property_doc_(''' this points's datum (L{Datum}).''')
266 def datum(self):
267 '''Get this point's datum (L{Datum}).
268 '''
269 return self._datum
271 @datum.setter # PYCHOK setter!
272 def datum(self, datum):
273 '''Set this point's datum I{without conversion} (L{Datum}).
275 @raise TypeError: The B{C{datum}} is not a L{Datum}
276 or not ellipsoidal.
277 '''
278 _xinstanceof(Datum, datum=datum)
279 if not datum.isEllipsoidal:
280 raise _IsnotError(_ellipsoidal_, datum=datum)
281 if self._datum != datum:
282 _update_all(self)
283 self._datum = datum
285 def distanceTo2(self, other, wrap=False):
286 '''I{Approximate} the distance and (initial) bearing between this
287 and an other (ellipsoidal) point based on the radii of curvature.
289 I{Suitable only for short distances up to a few hundred Km
290 or Miles and only between points not near-polar}.
292 @arg other: The other point (C{LatLon}).
293 @kwarg wrap: If C{True}, wrap or I{normalize} the B{C{other}}
294 point (C{bool}).
296 @return: An L{Distance2Tuple}C{(distance, initial)}.
298 @raise TypeError: The B{C{other}} point is not C{LatLon}.
300 @raise ValueError: Incompatible datum ellipsoids.
302 @see: Method L{Ellipsoid.distance2} and U{Local, flat earth
303 approximation<https://www.EdWilliams.org/avform.htm#flat>}
304 aka U{Hubeny<https://www.OVG.AT/de/vgi/files/pdf/3781/>}
305 formula.
306 '''
307 p = self.others(other)
308 if wrap:
309 p = _Wrap.point(p)
310 E = self.ellipsoids(other)
311 return E.distance2(*(self.latlon + p.latlon))
313 @Property_RO
314 def _elevation2(self):
315 '''(INTERNAL) Get elevation and data source.
316 '''
317 return _MODS.elevations.elevation2(self.lat, self.lon,
318 timeout=self._elevation2to)
320 def elevation2(self, adjust=True, datum=None, timeout=2):
321 '''Return elevation of this point for its or the given datum, ellipsoid
322 or sphere.
324 @kwarg adjust: Adjust the elevation for a B{C{datum}} other than
325 C{NAD83} (C{bool}).
326 @kwarg datum: Optional datum overriding this point's datum (L{Datum},
327 L{Ellipsoid}, L{Ellipsoid2}, L{a_f2Tuple} or C{scalar}
328 radius).
329 @kwarg timeout: Optional query timeout (C{seconds}).
331 @return: An L{Elevation2Tuple}C{(elevation, data_source)} or
332 C{(None, error)} in case of errors.
334 @note: The adjustment applied is the difference in geocentric earth
335 radius between the B{C{datum}} and C{NAV83} upon which the
336 L{elevations.elevation2} is based.
338 @note: NED elevation is only available for locations within the
339 U{Conterminous US (CONUS)
340 <https://WikiPedia.org/wiki/Contiguous_United_States>}.
342 @see: Function L{elevations.elevation2} and method C{Ellipsoid.Rgeocentric}
343 for further details and possible C{error}s.
344 '''
345 if self._elevation2to != timeout:
346 self._elevation2to = timeout
347 LatLonEllipsoidalBase._elevation2._update(self)
348 return self._Radjust2(adjust, datum, self._elevation2)
350 def ellipsoid(self, datum=_WGS84):
351 '''Return the ellipsoid of this point's datum or the given datum.
353 @kwarg datum: Default datum (L{Datum}).
355 @return: The ellipsoid (L{Ellipsoid} or L{Ellipsoid2}).
356 '''
357 return _xattr(self, datum=datum).ellipsoid
359 def ellipsoids(self, other):
360 '''Check the type and ellipsoid of this and an other point's datum.
362 @arg other: The other point (C{LatLon}).
364 @return: This point's datum ellipsoid (L{Ellipsoid} or L{Ellipsoid2}).
366 @raise TypeError: The B{C{other}} point is not C{LatLon}.
368 @raise ValueError: Incompatible datum ellipsoids.
369 '''
370 self.others(other, up=2) # ellipsoids' caller
372 E = self.ellipsoid()
373 try: # other may be Sphere, etc.
374 e = other.ellipsoid()
375 except AttributeError:
376 try: # no ellipsoid method, try datum
377 e = other.datum.ellipsoid
378 except AttributeError:
379 e = E # no datum, XXX assume equivalent?
380 if e != E:
381 raise _ValueError(e.named2, txt=_incompatible(E.named2))
382 return E
384 @property_doc_(''' this point's observed or C{reframe} epoch (C{float}).''')
385 def epoch(self):
386 '''Get this point's observed or C{reframe} epoch (C{float}) or C{None}.
387 '''
388 return self._epoch or (self.reframe.epoch if self.reframe else None)
390 @epoch.setter # PYCHOK setter!
391 def epoch(self, epoch):
392 '''Set or clear this point's observed epoch, a fractional
393 calendar year (L{Epoch}, C{scalar}) or C{None}.
395 @raise TRFError: Invalid B{C{epoch}}.
396 '''
397 self._epoch = None if epoch is None else Epoch(epoch)
399 @Property_RO
400 def Equidistant(self):
401 '''Get the prefered azimuthal equidistant projection I{class} (L{EquidistantKarney} or L{EquidistantExact}).
402 '''
403 try:
404 _ = self.datum.ellipsoid.geodesic
405 return _MODS.azimuthal.EquidistantKarney
406 except ImportError: # no geographiclib
407 return _MODS.azimuthal.EquidistantExact # XXX no longer L{azimuthal.Equidistant}
409 @Property_RO
410 def _etm(self):
411 '''(INTERNAL) Get this C{LatLon} point as an ETM coordinate (L{pygeodesy.toEtm8}).
412 '''
413 etm = _MODS.etm
414 return etm.toEtm8(self, datum=self.datum, Etm=etm.Etm)
416 @property_RO
417 def gamma(self):
418 '''Get this point's UTM or UPS meridian convergence (C{degrees}) or
419 C{None} if not available or not converted from L{Utm} or L{Ups}.
420 '''
421 return self._gamma
423 @Property_RO
424 def _geoidHeight2(self):
425 '''(INTERNAL) Get geoid height and model.
426 '''
427 return _MODS.elevations.geoidHeight2(self.lat, self.lon, model=0,
428 timeout=self._geoidHeight2to)
430 def geoidHeight2(self, adjust=False, datum=None, timeout=2):
431 '''Return geoid height of this point for its or the given datum, ellipsoid
432 or sphere.
434 @kwarg adjust: Adjust the geoid height for a B{C{datum}} other than
435 C{NAD83/NADV88} (C{bool}).
436 @kwarg datum: Optional datum overriding this point's datum (L{Datum},
437 L{Ellipsoid}, L{Ellipsoid2}, L{a_f2Tuple} or C{scalar}
438 radius).
439 @kwarg timeout: Optional query timeout (C{seconds}).
441 @return: A L{GeoidHeight2Tuple}C{(height, model_name)} or
442 C{(None, error)} in case of errors.
444 @note: The adjustment applied is the difference in geocentric earth
445 radius between the B{C{datum}} and C{NAV83/NADV88} upon which
446 the L{elevations.geoidHeight2} is based.
448 @note: The geoid height is only available for locations within the
449 U{Conterminous US (CONUS)
450 <https://WikiPedia.org/wiki/Contiguous_United_States>}.
452 @see: Function L{elevations.geoidHeight2} and method C{Ellipsoid.Rgeocentric}
453 for further details and possible C{error}s.
454 '''
455 if self._geoidHeight2to != timeout:
456 self._geoidHeight2to = timeout
457 LatLonEllipsoidalBase._geoidHeight2._update(self)
458 return self._Radjust2(adjust, datum, self._geoidHeight2)
460 def intermediateTo(self, other, fraction, height=None, wrap=False): # PYCHOK no cover
461 '''(INTERNAL) I{Must be overloaded}, see function C{notOverloaded}.
462 '''
463 _MODS.named.notOverloaded(self, other, fraction, height=height, wrap=wrap)
465 def intersection3(self, end1, other, end2, height=None, wrap=False, # was=True
466 equidistant=None, tol=_TOL_M):
467 '''I{Iteratively} compute the intersection point of two lines, each
468 defined by two points or a start point and bearing from North.
470 @arg end1: End point of this line (C{LatLon}) or the initial
471 bearing at this point (compass C{degrees360}).
472 @arg other: Start point of the other line (C{LatLon}).
473 @arg end2: End point of the other line (C{LatLon}) or the
474 initial bearing at the other point (compass
475 C{degrees360}).
476 @kwarg height: Optional height at the intersection (C{meter},
477 conventionally) or C{None} for the mean height.
478 @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
479 B{C{other}} and B{C{end*}} points (C{bool}).
480 @kwarg equidistant: An azimuthal equidistant projection (I{class} or
481 function L{pygeodesy.equidistant}), or C{None}
482 for this point's preferred C{.Equidistant}.
483 @kwarg tol: Tolerance for skew line distance and length and for
484 convergence (C{meter}, conventionally).
486 @return: An L{Intersection3Tuple}C{(point, outside1, outside2)}
487 with C{point} a C{LatLon} instance.
489 @raise ImportError: Package U{geographiclib
490 <https://PyPI.org/project/geographiclib>}
491 not installed or not found, but only if
492 C{B{equidistant}=}L{EquidistantKarney}.
494 @raise IntersectionError: Skew, colinear, parallel or otherwise
495 non-intersecting lines or no convergence
496 for the given B{C{tol}}.
498 @raise TypeError: If B{C{end1}}, B{C{other}} or B{C{end2}} point
499 is not C{LatLon}.
501 @note: For each line specified with an initial bearing, a pseudo-end
502 point is computed as the C{destination} along that bearing at
503 about 1.5 times the distance from the start point to an initial
504 gu-/estimate of the intersection point (and between 1/8 and 3/8
505 of the authalic earth perimeter).
507 @see: U{The B{ellipsoidal} case<https://GIS.StackExchange.com/questions/48937/
508 calculating-intersection-of-two-circles>} and U{Karney's paper
509 <https://ArXiv.org/pdf/1102.1215.pdf>}, pp 20-21, section B{14. MARITIME
510 BOUNDARIES} for more details about the iteration algorithm.
511 '''
512 try:
513 s2 = self.others(other)
514 return _MODS.ellipsoidalBaseDI._intersect3(self, end1,
515 s2, end2,
516 height=height, wrap=wrap,
517 equidistant=equidistant, tol=tol,
518 LatLon=self.classof, datum=self.datum)
519 except (TypeError, ValueError) as x:
520 raise _xError(x, start1=self, end1=end1, other=other, end2=end2,
521 height=height, wrap=wrap, tol=tol)
523 def intersections2(self, radius1, other, radius2, height=None, wrap=False, # was=True
524 equidistant=None, tol=_TOL_M):
525 '''I{Iteratively} compute the intersection points of two circles,
526 each defined by a center point and a radius.
528 @arg radius1: Radius of this circle (C{meter}, conventionally).
529 @arg other: Center of the other circle (C{LatLon}).
530 @arg radius2: Radius of the other circle (C{meter}, same units as
531 B{C{radius1}}).
532 @kwarg height: Optional height for the intersection points (C{meter},
533 conventionally) or C{None} for the I{"radical height"}
534 at the I{radical line} between both centers.
535 @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the B{C{other}}
536 center (C{bool}).
537 @kwarg equidistant: An azimuthal equidistant projection (I{class} or
538 function L{pygeodesy.equidistant}), or C{None}
539 for this point's preferred C{.Equidistant}.
540 @kwarg tol: Convergence tolerance (C{meter}, same units as
541 B{C{radius1}} and B{C{radius2}}).
543 @return: 2-Tuple of the intersection points, each a C{LatLon}
544 instance. For abutting circles, both intersection
545 points are the same instance, aka the I{radical center}.
547 @raise ImportError: Package U{geographiclib
548 <https://PyPI.org/project/geographiclib>}
549 not installed or not found, but only if
550 C{B{equidistant}=}L{EquidistantKarney}.
552 @raise IntersectionError: Concentric, antipodal, invalid or
553 non-intersecting circles or no
554 convergence for the given B{C{tol}}.
556 @raise TypeError: Invalid B{C{other}} or B{C{equidistant}}.
558 @raise UnitError: Invalid B{C{radius1}}, B{C{radius2}} or B{C{height}}.
560 @see: U{The B{ellipsoidal} case<https://GIS.StackExchange.com/questions/48937/
561 calculating-intersection-of-two-circles>}, U{Karney's paper
562 <https://ArXiv.org/pdf/1102.1215.pdf>}, pp 20-21, section B{14. MARITIME BOUNDARIES},
563 U{circle-circle<https://MathWorld.Wolfram.com/Circle-CircleIntersection.html>} and
564 U{sphere-sphere<https://MathWorld.Wolfram.com/Sphere-SphereIntersection.html>}
565 intersections.
566 '''
567 try:
568 c2 = self.others(other)
569 return _MODS.ellipsoidalBaseDI._intersections2(self, radius1,
570 c2, radius2,
571 height=height, wrap=wrap,
572 equidistant=equidistant, tol=tol,
573 LatLon=self.classof, datum=self.datum)
574 except (AssertionError, TypeError, ValueError) as x:
575 raise _xError(x, center=self, radius1=radius1, other=other, radius2=radius2,
576 height=height, wrap=wrap, tol=tol)
578 @Property_RO
579 def isEllipsoidalLatLon(self):
580 '''Get C{LatLon} base.
581 '''
582 return True
584 def isenclosedBy(self, points, wrap=False):
585 '''Check whether a polygon or composite encloses this point.
587 @arg points: The polygon points or clips (C{LatLon}[],
588 L{BooleanFHP} or L{BooleanGH}).
589 @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
590 B{C{points}} (C{bool}).
592 @return: C{True} if this point is inside the polygon or composite,
593 C{False} otherwise.
595 @raise PointsError: Insufficient number of B{C{points}}.
597 @raise TypeError: Some B{C{points}} are not C{LatLon}.
599 @raise ValueError: Invalid B{C{point}}, lat- or longitude.
601 @see: Functions L{pygeodesy.isconvex}, L{pygeodesy.isenclosedBy}
602 and L{pygeodesy.ispolar} especially if the B{C{points}} may
603 enclose a pole or wrap around the earth I{longitudinally}.
604 '''
605 return _MODS.points.isenclosedBy(self, points, wrap=wrap)
607 @property_RO
608 def iteration(self):
609 '''Get the most recent C{intersections2} or C{nearestOn} iteration
610 number (C{int}) or C{None} if not available/applicable.
611 '''
612 return self._iteration
614 @Property_RO
615 def _lcc(self):
616 '''(INTERNAL) Get this C{LatLon} point as a Lambert location (L{Lcc}).
617 '''
618 lcc = _MODS.lcc
619 return lcc.toLcc(self, height=self.height, Lcc=lcc.Lcc, name=self.name)
621 def midpointTo(self, other, height=None, fraction=_0_5, wrap=False):
622 '''Find the midpoint on a geodesic between this and an other point.
624 @arg other: The other point (C{LatLon}).
625 @kwarg height: Optional height for midpoint, overriding the
626 mean height (C{meter}).
627 @kwarg fraction: Midpoint location from this point (C{scalar}),
628 may be negative or greater than 1.0.
629 @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
630 B{C{other}} point (C{bool}).
632 @return: Midpoint (C{LatLon}).
634 @raise TypeError: The B{C{other}} point is not C{LatLon}.
636 @raise ValueError: Invalid B{C{height}}.
638 @see: Methods C{intermediateTo} and C{rhumbMidpointTo}.
639 '''
640 return self.intermediateTo(other, fraction, height=height, wrap=wrap)
642 def nearestOn(self, point1, point2, within=True, height=None, wrap=False, # was=True
643 equidistant=None, tol=_TOL_M):
644 '''I{Iteratively} locate the closest point on the geodesic between
645 two other (ellipsoidal) points.
647 @arg point1: Start point (C{LatLon}).
648 @arg point2: End point (C{LatLon}).
649 @kwarg within: If C{True} return the closest point I{between}
650 B{C{point1}} and B{C{point2}}, otherwise the
651 closest point elsewhere on the geodesic (C{bool}).
652 @kwarg height: Optional height for the closest point (C{meter},
653 conventionally) or C{None} or C{False} for the
654 interpolated height. If C{False}, the closest
655 takes the heights of the points into account.
656 @kwarg wrap: If C{True}, wrap or I{normalize} and unroll both
657 B{C{point1}} and B{C{point2}} (C{bool}).
658 @kwarg equidistant: An azimuthal equidistant projection (I{class} or
659 function L{pygeodesy.equidistant}), or C{None}
660 for this point's preferred C{.Equidistant}.
661 @kwarg tol: Convergence tolerance (C{meter}, conventionally).
663 @return: Closest point (C{LatLon}).
665 @raise ImportError: Package U{geographiclib
666 <https://PyPI.org/project/geographiclib>}
667 not installed or not found, but only if
668 C{B{equidistant}=}L{EquidistantKarney}.
670 @raise TypeError: Invalid B{C{point1}}, B{C{point2}} or
671 B{C{equidistant}}.
673 @raise ValueError: Datum or ellipsoid of B{C{point1}} or B{C{point2}} is
674 incompatible or no convergence for the given B{C{tol}}.
676 @see: U{The B{ellipsoidal} case<https://GIS.StackExchange.com/questions/48937/
677 calculating-intersection-of-two-circles>} and U{Karney's paper
678 <https://ArXiv.org/pdf/1102.1215.pdf>}, pp 20-21, section B{14. MARITIME
679 BOUNDARIES} for details about the iteration algorithm.
680 '''
681 try:
682 t = _MODS.ellipsoidalBaseDI._nearestOn2(self, point1, point2, within=within,
683 height=height, wrap=wrap,
684 equidistant=equidistant,
685 tol=tol, LatLon=self.classof)
686 except (TypeError, ValueError) as x:
687 raise _xError(x, point=self, point1=point1, point2=point2, within=within,
688 height=height, wrap=wrap, tol=tol)
689 return t.closest
691 @Property_RO
692 def _osgr(self):
693 '''(INTERNAL) Get this C{LatLon} point as an OSGR coordinate (L{Osgr}),
694 based on the OS recommendation.
695 '''
696 return _MODS.osgr.toOsgr(self, kTM=False, name=self.name) # datum=self.datum
698 @Property_RO
699 def _osgrTM(self):
700 '''(INTERNAL) Get this C{LatLon} point as an OSGR coordinate (L{Osgr})
701 based on I{Karney}'s Krüger implementation.
702 '''
703 return _MODS.osgr.toOsgr(self, kTM=True, name=self.name) # datum=self.datum
705 def parse(self, strllh, height=0, datum=None, epoch=None, reframe=None,
706 sep=_COMMA_, wrap=False, name=NN):
707 '''Parse a string consisting of C{"lat, lon[, height]"},
708 representing a similar, ellipsoidal C{LatLon} point.
710 @arg strllh: Lat, lon and optional height (C{str}),
711 see function L{pygeodesy.parse3llh}.
712 @kwarg height: Optional, default height (C{meter} or
713 C{None}).
714 @kwarg datum: Optional datum (L{Datum}), overriding this
715 datum I{without conversion}.
716 @kwarg epoch: Optional datum (L{Epoch}), overriding this
717 epoch I{without conversion}.
718 @kwarg reframe: Optional datum (L{RefFrame}), overriding
719 this reframe I{without conversion}.
720 @kwarg sep: Optional separator (C{str}).
721 @kwarg wrap: If C{True}, wrap or I{normalize} the lat-
722 and longitude (C{bool}).
723 @kwarg name: Optional instance name (C{str}), overriding
724 this name.
726 @return: The similar point (ellipsoidal C{LatLon}).
728 @raise ParseError: Invalid B{C{strllh}}.
729 '''
730 a, b, h = _MODS.dms.parse3llh(strllh, height=height, sep=sep, wrap=wrap)
731 r = self.classof(a, b, height=h, datum=self.datum)
732 if datum not in (None, self.datum):
733 r.datum = datum
734 if epoch not in (None, self.epoch):
735 r.epoch = epoch
736 if reframe not in (None, self.reframe):
737 r.reframe = reframe
738 return self._xnamed(r, name=name, force=True) if name else r
740 def _Radjust2(self, adjust, datum, meter_text2):
741 '''(INTERNAL) Adjust an C{elevation} or C{geoidHeight} with
742 difference in Gaussian radii of curvature of the given
743 datum and NAD83 ellipsoids at this point's latitude.
745 @note: This is an arbitrary, possibly incorrect adjustment.
746 '''
747 if adjust: # Elevation2Tuple or GeoidHeight2Tuple
748 m, t = meter_text2
749 if isinstance(m, float) and fabs(m) > EPS:
750 n = Datums.NAD83.ellipsoid.rocGauss(self.lat)
751 if n > EPS0:
752 # use ratio, datum and NAD83 units may differ
753 E = self.ellipsoid() if datum in (None, self.datum) else \
754 _spherical_datum(datum).ellipsoid
755 r = E.rocGauss(self.lat)
756 if r > EPS0 and fabs(r - n) > EPS: # EPS1
757 m *= r / n
758 meter_text2 = meter_text2.classof(m, t)
759 return self._xnamed(meter_text2)
761 @property_doc_(''' this point's reference frame (L{RefFrame}).''')
762 def reframe(self):
763 '''Get this point's reference frame (L{RefFrame}) or C{None}.
764 '''
765 return self._reframe
767 @reframe.setter # PYCHOK setter!
768 def reframe(self, reframe):
769 '''Set or clear this point's reference frame (L{RefFrame}) or C{None}.
771 @raise TypeError: The B{C{reframe}} is not a L{RefFrame}.
772 '''
773 _set_reframe(self, reframe)
775 @Property_RO
776 def scale(self):
777 '''Get this point's UTM grid or UPS point scale factor (C{float})
778 or C{None} if not converted from L{Utm} or L{Ups}.
779 '''
780 return self._scale
782 def toCss(self, **toCss_kwds):
783 '''Convert this C{LatLon} point to a Cassini-Soldner location.
785 @kwarg toCss_kwds: Optional L{pygeodesy.toCss} keyword arguments.
787 @return: The Cassini-Soldner location (L{Css}).
789 @see: Function L{pygeodesy.toCss}.
790 '''
791 return self._css if not toCss_kwds else _MODS.css.toCss(
792 self, **_xkwds(toCss_kwds, name=self.name))
794 def toDatum(self, datum2, height=None, name=NN):
795 '''Convert this point to an other datum.
797 @arg datum2: Datum to convert I{to} (L{Datum}).
798 @kwarg height: Optional height, overriding the
799 converted height (C{meter}).
800 @kwarg name: Optional name (C{str}), iff converted.
802 @return: The converted point (ellipsoidal C{LatLon})
803 or a copy of this point if B{C{datum2}}
804 matches this point's C{datum}.
806 @raise TypeError: Invalid B{C{datum2}}.
808 @example:
810 >>> p = LatLon(51.4778, -0.0016) # default Datums.WGS84
811 >>> p.toDatum(Datums.OSGB36) # 51.477284°N, 000.00002°E
812 '''
813 n = name or self.name
814 d2 = _ellipsoidal_datum(datum2, name=n)
815 if self.datum == d2:
816 r = self.copy(name=name)
817 else:
818 kwds = _xkwds_not(None, LatLon=self.classof, name=n,
819 epoch=self.epoch, reframe=self.reframe)
820 c = self.toCartesian().toDatum(d2)
821 r = c.toLatLon(datum=d2, height=height, **kwds)
822 return r
824 def toEtm(self, **toEtm8_kwds):
825 '''Convert this C{LatLon} point to an ETM coordinate.
827 @kwarg toEtm8_kwds: Optional L{pygeodesy.toEtm8} keyword arguments.
829 @return: The ETM coordinate (L{Etm}).
831 @see: Function L{pygeodesy.toEtm8}.
832 '''
833 return self._etm if not toEtm8_kwds else _MODS.etm.toEtm8(
834 self, **_xkwds(toEtm8_kwds, name=self.name))
836 def toLcc(self, **toLcc_kwds):
837 '''Convert this C{LatLon} point to a Lambert location.
839 @kwarg toLcc_kwds: Optional L{pygeodesy.toLcc} keyword arguments.
841 @return: The Lambert location (L{Lcc}).
843 @see: Function L{pygeodesy.toLcc}.
844 '''
845 return self._lcc if not toLcc_kwds else _MODS.lcc.toLcc(
846 self, **_xkwds(toLcc_kwds, name=self.name))
848 def toMgrs(self, center=False, pole=NN):
849 '''Convert this C{LatLon} point to an MGRS coordinate.
851 @kwarg center: If C{True}, try to I{un}-center MGRS
852 to its C{lowerleft} (C{bool}) or by
853 C{B{center} meter} (C{scalar}).
854 @kwarg pole: Optional top/center for the MGRS UPS
855 projection (C{str}, 'N[orth]' or 'S[outh]').
857 @return: The MGRS coordinate (L{Mgrs}).
859 @see: Method L{toUtmUps} and L{Mgrs.toLatLon}.
860 '''
861 return self.toUtmUps(center=center, pole=pole).toMgrs(center=False)
863 def toOsgr(self, kTM=False, **toOsgr_kwds):
864 '''Convert this C{LatLon} point to an OSGR coordinate.
866 @kwarg kTM: If C{True} use I{Karney}'s Krüger method from module
867 L{ktm}, otherwise I{Ordinance Survery}'s recommended
868 formulation (C{bool}).
869 @kwarg toOsgr_kwds: Optional L{pygeodesy.toOsgr} keyword arguments.
871 @return: The OSGR coordinate (L{Osgr}).
873 @see: Function L{pygeodesy.toOsgr}.
874 '''
875 if toOsgr_kwds:
876 r = _MODS.osgr.toOsgr(self, kTM=kTM, **_xkwds(toOsgr_kwds, name=self.name))
877 else:
878 r = self._osgrTM if kTM else self._osgr
879 return r
881 def toRefFrame(self, reframe2, height=None, name=NN):
882 '''Convert this point to an other reference frame.
884 @arg reframe2: Reference frame to convert I{to} (L{RefFrame}).
885 @kwarg height: Optional height, overriding the converted
886 height (C{meter}).
887 @kwarg name: Optional name (C{str}), iff converted.
889 @return: The converted point (ellipsoidal C{LatLon}) or this
890 point if conversion is C{nil}, or a copy of this
891 point if the B{C{name}} is non-empty.
893 @raise TRFError: This point's C{reframe} is not defined or
894 conversion from this point's C{reframe} to
895 B{C{reframe2}} is not available.
897 @raise TypeError: Invalid B{C{reframe2}}, not a L{RefFrame}.
899 @example:
901 >>> p = LatLon(51.4778, -0.0016, reframe=RefFrames.ETRF2000) # default Datums.WGS84
902 >>> p.toRefFrame(RefFrames.ITRF2014) # 51.477803°N, 000.001597°W, +0.01m
903 >>> p.toRefFrame(RefFrames.ITRF2014, height=0) # 51.477803°N, 000.001597°W
904 '''
905 if not self.reframe:
906 t = _SPACE_(_DOT_(repr(self), _reframe_), MISSING)
907 raise TRFError(_no_(_conversion_), txt=t)
909 trf = _MODS.trf
910 trf._xinstanceof(trf.RefFrame, reframe2=reframe2)
912 e, xs = trf._reframeTransforms2(reframe2, self.reframe, self.epoch)
913 if xs:
914 c = self.toCartesian().toTransforms_(*xs)
915 n = name or self.name
916 ll = c.toLatLon(datum=self.datum, epoch=e, height=height,
917 LatLon=self.classof, name=n, reframe=reframe2)
918 else:
919 ll = self.copy(name=name) if name else self
920 return ll
922 def toUps(self, pole=NN, falsed=True, center=False):
923 '''Convert this C{LatLon} point to a UPS coordinate.
925 @kwarg pole: Optional top/center of (stereographic)
926 projection (C{str}, 'N[orth]' or 'S[outh]').
927 @kwarg falsed: False easting and northing (C{bool}).
928 @kwarg center: If C{True}, I{un}-center the UPS
929 to its C{lowerleft} (C{bool}) or
930 by C{B{center} meter} (C{scalar}).
932 @return: The UPS coordinate (L{Ups}).
934 @see: Function L{pygeodesy.toUps8}.
935 '''
936 if self._upsOK(pole, falsed):
937 u = self._ups
938 else:
939 ups = _MODS.ups
940 u = ups.toUps8(self, datum=self.datum, Ups=ups.Ups,
941 pole=pole, falsed=falsed)
942 return _lowerleft(u, center)
944 def toUtm(self, center=False):
945 '''Convert this C{LatLon} point to a UTM coordinate.
947 @kwarg center: If C{True}, I{un}-center the UTM
948 to its C{lowerleft} (C{bool}) or
949 by C{B{center} meter} (C{scalar}).
951 @return: The UTM coordinate (L{Utm}).
953 @see: Method L{Mgrs.toUtm} and function L{pygeodesy.toUtm8}.
954 '''
955 return _lowerleft(self._utm, center)
957 def toUtmUps(self, pole=NN, center=False):
958 '''Convert this C{LatLon} point to a UTM or UPS coordinate.
960 @kwarg pole: Optional top/center of UPS (stereographic)
961 projection (C{str}, 'N[orth]' or 'S[outh]').
962 @kwarg center: If C{True}, I{un}-center the UTM or UPS to
963 its C{lowerleft} (C{bool}) or by C{B{center}
964 meter} (C{scalar}).
966 @return: The UTM or UPS coordinate (L{Utm} or L{Ups}).
968 @see: Function L{pygeodesy.toUtmUps8}.
969 '''
970 if self._utmOK():
971 u = self._utm
972 elif self._upsOK(pole):
973 u = self._ups
974 else: # no cover
975 utmups = _MODS.utmups
976 u = utmups.toUtmUps8(self, datum=self.datum, pole=pole, name=self.name,
977 Utm=utmups.Utm, Ups=utmups.Ups)
978 if isinstance(u, utmups.Utm):
979 self._update(False, _utm=u) # PYCHOK kwds
980 elif isinstance(u, utmups.Ups):
981 self._update(False, _ups=u) # PYCHOK kwds
982 else:
983 _xinstanceof(utmups.Utm, utmups.Ups, toUtmUps8=u)
984 return _lowerleft(u, center)
986 @deprecated_method
987 def to3xyz(self): # PYCHOK no cover
988 '''DEPRECATED, use method C{toEcef}.
990 @return: A L{Vector3Tuple}C{(x, y, z)}.
992 @note: Overloads C{LatLonBase.to3xyz}
993 '''
994 r = self.toEcef()
995 return Vector3Tuple(r.x, r.y, r.z, name=self.name)
997 def trilaterate5(self, distance1, point2, distance2, point3, distance3,
998 area=True, eps=EPS1, wrap=False):
999 '''Trilaterate three points by I{area overlap} or I{perimeter
1000 intersection} of three intersecting circles.
1002 @arg distance1: Distance to this point (C{meter}), same units
1003 as B{C{eps}}).
1004 @arg point2: Second center point (C{LatLon}).
1005 @arg distance2: Distance to point2 (C{meter}, same units as
1006 B{C{eps}}).
1007 @arg point3: Third center point (C{LatLon}).
1008 @arg distance3: Distance to point3 (C{meter}, same units as
1009 B{C{eps}}).
1010 @kwarg area: If C{True} compute the area overlap, otherwise the
1011 perimeter intersection of the circles (C{bool}).
1012 @kwarg eps: The required I{minimal overlap} for C{B{area}=True}
1013 or the I{intersection margin} for C{B{area}=False}
1014 (C{meter}, conventionally).
1015 @kwarg wrap: If C{True}, wrap or I{normalize} and unroll
1016 B{C{point2}} and B{C{point3}} (C{bool}).
1018 @return: A L{Trilaterate5Tuple}C{(min, minPoint, max, maxPoint, n)}
1019 with C{min} and C{max} in C{meter}, same units as B{C{eps}},
1020 the corresponding trilaterated points C{minPoint} and
1021 C{maxPoint} as I{ellipsoidal} C{LatLon} and C{n}, the number
1022 of trilatered points found for the given B{C{eps}}.
1024 If only a single trilaterated point is found, C{min I{is}
1025 max}, C{minPoint I{is} maxPoint} and C{n = 1}.
1027 For C{B{area}=True}, C{min} and C{max} are the smallest
1028 respectively largest I{radial} overlap found.
1030 For C{B{area}=False}, C{min} and C{max} represent the
1031 nearest respectively farthest intersection margin.
1033 If C{B{area}=True} and all 3 circles are concentric, C{n=0}
1034 and C{minPoint} and C{maxPoint} are the B{C{point#}} with
1035 the smallest B{C{distance#}} C{min} respectively C{max} the
1036 largest B{C{distance#}}.
1038 @raise IntersectionError: Trilateration failed for the given B{C{eps}},
1039 insufficient overlap for C{B{area}=True} or
1040 no intersection or all (near-)concentric for
1041 C{B{area}=False}.
1043 @raise TypeError: Invalid B{C{point2}} or B{C{point3}}.
1045 @raise ValueError: Coincident B{C{points}} or invalid B{C{distance1}},
1046 B{C{distance2}} or B{C{distance3}}.
1048 @note: Ellipsoidal trilateration invokes methods C{LatLon.intersections2}
1049 and C{LatLon.nearestOn} based on I{Karney}'s Python U{geographiclib
1050 <https://PyPI.org/project/geographiclib>} if installed, otherwise
1051 the accurate (but slower) C{ellipsoidalExact.LatLon} methods.
1052 '''
1053 return _trilaterate5(self, distance1,
1054 self.others(point2=point2), distance2,
1055 self.others(point3=point3), distance3,
1056 area=area, eps=eps, wrap=wrap)
1058 @Property_RO
1059 def _ups(self): # __dict__ value overwritten by method C{toUtmUps}
1060 '''(INTERNAL) Get this C{LatLon} point as UPS coordinate (L{Ups}),
1061 see L{pygeodesy.toUps8}.
1062 '''
1063 ups = _MODS.ups
1064 return ups.toUps8(self, datum=self.datum, Ups=ups.Ups,
1065 pole=NN, falsed=True, name=self.name)
1067 def _upsOK(self, pole=NN, falsed=True):
1068 '''(INTERNAL) Check matching C{Ups}.
1069 '''
1070 try:
1071 u = self._ups
1072 except RangeError:
1073 return False
1074 return falsed and (u.pole == pole[:1].upper() or not pole)
1076 @Property_RO
1077 def _utm(self): # __dict__ value overwritten by method C{toUtmUps}
1078 '''(INTERNAL) Get this C{LatLon} point as UTM coordinate (L{Utm}),
1079 see L{pygeodesy.toUtm8}.
1080 '''
1081 utm = _MODS.utm
1082 return utm.toUtm8(self, datum=self.datum, Utm=utm.Utm, name=self.name)
1084 def _utmOK(self):
1085 '''(INTERNAL) Check C{Utm}.
1086 '''
1087 try:
1088 _ = self._utm
1089 except RangeError:
1090 return False
1091 return True
1094def _lowerleft(utmups, center):
1095 '''(INTERNAL) Optionally I{un}-center C{utmups}.
1096 '''
1097 if center in (False, 0, _0_0):
1098 u = utmups
1099 elif center in (True,):
1100 u = utmups._lowerleft
1101 else:
1102 u = _MODS.utmupsBase._lowerleft(utmups, center)
1103 return u
1106def _nearestOn(point, point1, point2, within=True, height=None, wrap=False, # was=True
1107 equidistant=None, tol=_TOL_M, **LatLon_and_kwds):
1108 '''(INTERNAL) Get closest point, imported by .ellipsoidalExact,
1109 -GeodSolve, -Karney and -Vincenty to embellish exceptions.
1110 '''
1111 try:
1112 p = _xellipsoidal(point=point)
1113 t = _MODS.ellipsoidalBaseDI._nearestOn2(p, point1, point2, within=within,
1114 height=height, wrap=wrap,
1115 equidistant=equidistant,
1116 tol=tol, **LatLon_and_kwds)
1117 except (TypeError, ValueError) as x:
1118 raise _xError(x, point=point, point1=point1, point2=point2)
1119 return t.closest
1122def _set_reframe(inst, reframe):
1123 '''(INTERNAL) Set or clear an instance's reference frame.
1124 '''
1125 if reframe is not None:
1126 _xinstanceof(_MODS.trf.RefFrame, reframe=reframe)
1127 inst._reframe = reframe
1128 elif inst.reframe is not None:
1129 inst._reframe = None
1132__all__ += _ALL_DOCS(CartesianEllipsoidalBase, LatLonEllipsoidalBase)
1134# **) MIT License
1135#
1136# Copyright (C) 2016-2023 -- mrJean1 at Gmail -- All Rights Reserved.
1137#
1138# Permission is hereby granted, free of charge, to any person obtaining a
1139# copy of this software and associated documentation files (the "Software"),
1140# to deal in the Software without restriction, including without limitation
1141# the rights to use, copy, modify, merge, publish, distribute, sublicense,
1142# and/or sell copies of the Software, and to permit persons to whom the
1143# Software is furnished to do so, subject to the following conditions:
1144#
1145# The above copyright notice and this permission notice shall be included
1146# in all copies or substantial portions of the Software.
1147#
1148# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1149# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1150# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1151# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
1152# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1153# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1154# OTHER DEALINGS IN THE SOFTWARE.