Coverage for pygeodesy/lcc.py : 96%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
Lambert conformal conic projection for 1- or 2-Standard Parallels classes L{Conic}, L{Conics} registry, L{LCCError} and position class L{Lcc}.
See U{LCC<https://WikiPedia.org/wiki/Lambert_conformal_conic_projection>}, U{Lambert Conformal Conic to Geographic Transformation Formulae <https://www.Linz.govt.NZ/data/geodetic-system/coordinate-conversion/projection-conversions/lambert-conformal-conic-geographic>}, U{Lambert Conformal Conic Projection<https://MathWorld.Wolfram.com/LambertConformalConicProjection.html>} and John P. Snyder U{'Map Projections - A Working Manual'<https://Pubs.USGS.gov/pp/1395/report.pdf>}, 1987, pp 107-109.
@var Conics.Be08Lb: Conic(name='Be08Lb', lat0=50.797815, lon0=4.35921583, par1=49.8333339, par2=51.1666672, E0=649328, N0=665262, k0=1, SP=2, datum=Datum(name='GRS80', ellipsoid=Ellipsoids.GRS80, transform=Transforms.WGS84), @var Conics.Be72Lb: Conic(name='Be72Lb', lat0=90, lon0=4.3674867, par1=49.8333339, par2=51.1666672, E0=150000.013, N0=5400088.438, k0=1, SP=2, datum=Datum(name='NAD83', ellipsoid=Ellipsoids.GRS80, transform=Transforms.NAD83), @var Conics.Fr93Lb: Conic(name='Fr93Lb', lat0=46.5, lon0=3, par1=49, par2=44, E0=700000, N0=6600000, k0=1, SP=2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Transforms.WGS84), @var Conics.MaNLb: Conic(name='MaNLb', lat0=33.3, lon0=-5.4, par1=31.73, par2=34.87, E0=500000, N0=300000, k0=1, SP=2, datum=Datum(name='NTF', ellipsoid=Ellipsoids.Clarke1880IGN, transform=Transforms.NTF), @var Conics.MxLb: Conic(name='MxLb', lat0=12, lon0=-102, par1=17.5, par2=29.5, E0=2500000, N0=0, k0=1, SP=2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Transforms.WGS84), @var Conics.PyT_Lb: Conic(name='PyT_Lb', lat0=46.8, lon0=2.33722917, par1=45.8989389, par2=47.6960144, E0=600000, N0=200000, k0=1, SP=2, datum=Datum(name='NTF', ellipsoid=Ellipsoids.Clarke1880IGN, transform=Transforms.NTF), @var Conics.USA_Lb: Conic(name='USA_Lb', lat0=23, lon0=-96, par1=33, par2=45, E0=0, N0=0, k0=1, SP=2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Transforms.WGS84), @var Conics.WRF_Lb: Conic(name='WRF_Lb', lat0=40, lon0=-97, par1=33, par2=45, E0=0, N0=0, k0=1, SP=2, datum=Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Transforms.WGS84) ''' # make sure int/int division yields float quotient, see .basics
_EPS0__2, _float as _F, _GRS80_, _k0_, _lat0_, \ _lon0_, _m_, _NAD83_, _NTF_, _SPACE_, _WGS84_, \ _0_0, _0_5, _1_0, _90_0 _NamedEnum, _NamedEnumItem, nameof, _xnamed LatLon2Tuple, _LL4Tuple, PhiLam2Tuple
'''Lambert conformal conic projection (1- or 2-SP). '''
k0=1, opt3=0, name=NN, auth=NN): '''New Lambert conformal conic projection.
@arg latlon0: Origin with (ellipsoidal) datum (C{LatLon}). @arg par1: First standard parallel (C{degrees90}). @kwarg par2: Optional, second standard parallel (C{degrees90}). @kwarg E0: Optional, false easting (C{meter}). @kwarg N0: Optional, false northing (C{meter}). @kwarg k0: Optional scale factor (C{scalar}). @kwarg opt3: Optional meridian (C{degrees180}). @kwarg name: Optional name of the conic (C{str}). @kwarg auth: Optional authentication authority (C{str}).
@return: A Lambert projection (L{Conic}).
@raise TypeError: Non-ellipsoidal B{C{latlon0}}.
@raise ValueError: Invalid B{C{par1}}, B{C{par2}}, B{C{E0}}, B{C{N0}}, B{C{k0}} or B{C{opt3}}.
@example:
>>> from pygeodesy import Conic, Datums, ellipsoidalNvector >>> ll0 = ellipsoidalNvector.LatLon(23, -96, datum=Datums.NAD27) >>> Snyder = Conic(ll0, 33, 45, E0=0, N0=0, name='Snyder') '''
self._k0 = Scalar_(k0=k0) self._opt3 = Lam_(opt3=opt3)
'''Get the authentication authority (C{str}). '''
'''DEPRECATED, use method L{Conic.toDatum}.''' return self.toDatum(datum)
'''Get the datum (L{Datum}). '''
'''Get the false easting (C{meter}). '''
'''Get scale factor (C{float}). '''
'''Get the origin latitude (C{degrees90}). '''
'''Get the central origin (L{LatLon2Tuple}C{(lat, lon)}). '''
'''Get the central meridian (C{radians}). '''
'''Get the central meridian (C{degrees180}). '''
'''Get the false northing (C{meter}). '''
'''Get the conic and datum names as "conic.datum" (C{str}). '''
'''Get the optional meridian (C{degrees180}). '''
'''Get the 1st standard parallel (C{degrees90}). '''
'''Get the 2nd standard parallel (C{degrees90}). '''
'''Get the origin latitude (C{radians}). '''
'''Get the central origin (L{PhiLam2Tuple}C{(phi, lam)}). '''
'''Get the number of standard parallels (C{int}). '''
'''Convert this conic to the given datum.
@arg datum: Ellipsoidal datum to use (L{Datum}, L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}).
@return: Converted conic, unregistered (L{Conic}).
@raise TypeError: Non-ellipsoidal B{C{datum}}. ''' raise _IsnotError(_ellipsoidal_, datum=datum)
else: / (log(t1) - log(t2))
'''Return this conic as a string.
@kwarg prec: Optional number of decimals, unstripped (C{int}).
@return: Conic attributes (C{str}). ''' _E0_, _N0_, _k0_, _SP_, datum=self.datum) else: _E0_, _N0_, _k0_, _SP_, datum=self.datum)
'''(INTERNAL) Copy this conic to C{c}.
@arg c: Duplicate (L{Conic}). '''
'''(INTERNAL) Compute m(a). '''
'''(INTERNAL) Compute p(a). '''
'''(INTERNAL) Compute r(t). '''
'''(INTERNAL) Compute t(lat). '''
'''(INTERNAL) Compute x(t_x). '''
'''(INTERNAL) L{Conic} registry, I{must} be a sub-class to accommodate the L{_LazyNamedEnumItem} properties. ''' '''(INTERNAL) Instantiate the L{Conic}. '''
'''Some pre-defined L{Conic}s, all I{lazily} instantiated.''' # AsLb = _lazy('AsLb', _F(-14.2666667), _F(170), _NAD27_, _0_0, _0_0, # E0=_F(500000), N0=_0_0, auth='EPSG:2155'), # American Samoa ... SP=1 ! Be08Lb = _lazy('Be08Lb', _F(50.7978150), _F(4.359215833), _GRS80_, _F(49.8333339), _F(51.1666672), E0=_F(649328.0), N0=_F(665262.0), auth='EPSG:9802'), # Belgium Be72Lb = _lazy('Be72Lb', _90_0, _F(4.3674867), _NAD83_, _F(49.8333339), _F(51.1666672), E0=_F(150000.013), N0=_F(5400088.438), auth='EPSG:31370'), # Belgium Fr93Lb = _lazy('Fr93Lb', _F(46.5), _F(3), _WGS84_, _F(49), _F(44), E0=_F(700000), N0=_F(6600000), auth='EPSG:2154'), # RFG93, France MaNLb = _lazy('MaNLb', _F(33.3), _F(-5.4), _NTF_, _F(31.73), _F(34.87), E0=_F(500000), N0=_F(300000)), # Marocco MxLb = _lazy('MxLb', _F(12), _F(-102), _WGS84_, _F(17.5), _F(29.5), E0=_F(2500000), N0=_0_0, auth='EPSG:2155'), # Mexico PyT_Lb = _lazy('PyT_Lb', _F(46.8), _F(2.33722917), _NTF_, _F(45.89893890000052), _F(47.69601440000037), E0=_F(600000), N0=_F(200000), auth='Test'), # France? USA_Lb = _lazy('USA_Lb', _F(23), _F(-96), _WGS84_, _F(33), _F(45), E0=_0_0, N0=_0_0), # Conterminous, contiguous USA? WRF_Lb = _lazy('WRF_Lb', _F(40), _F(-97), _WGS84_, _F(33), _F(45), E0=_0_0, N0=_0_0, auth='EPSG:4326') # World )
'''Lambert Conformal Conic C{LCC} or other L{Lcc} issue. '''
'''Lambert conformal conic East-/Northing location. '''
'''New L{Lcc} Lamber conformal conic position.
@arg e: Easting (C{meter}). @arg n: Northing (C{meter}). @kwarg h: Optional height (C{meter}). @kwarg conic: Optional, the conic projection (L{Conic}). @kwarg name: Optional name (C{str}).
@return: The Lambert location (L{Lcc}).
@raise LCCError: Invalid B{C{h}} or invalid or negative B{C{e}} or B{C{n}}.
@raise TypeError: If B{C{conic}} is not L{Conic}.
@example:
>>> lb = Lcc(448251, 5411932.0001) ''' self._height = Height(h=h, Error=LCCError)
'''Get the conic projection (L{Conic}). '''
'''Get the easting (C{meter}). '''
'''Get the height (C{meter}). '''
'''Get the lat- and longitude in C{degrees} (L{LatLon2Tuple}). '''
'''Get the lat-, longitude and height (L{LatLon3Tuple}C{(lat, lon, height)}). ''' return self.latlon.to3Tuple(self.height)
'''Get the lat-, longitude in C{degrees} with height and datum (L{LatLon4Tuple}C{(lat, lon, height, datum)}). ''' return self.latlonheight.to4Tuple(self.conic.datum)
'''Get the northing (C{meter}). '''
'''Get the lat- and longitude in C{radians} (L{PhiLam2Tuple}). ''' radians(self.latlon.lon), name=self.name)
'''Get the lat-, longitude in C{radians} and height (L{PhiLam3Tuple}C{(phi, lam, height)}). ''' return self.philam.to3Tuple(self.height)
'''Get the lat-, longitude in C{radians} with height and datum (L{PhiLam4Tuple}C{(phi, lam, height, datum)}). ''' return self.philamheight.to4Tuple(self.datum)
def to3lld(self, datum=None): # PYCHOK no cover '''DEPRECATED, use method C{toLatLon}.
@kwarg datum: Optional datum to use, otherwise use this B{C{Lcc}}'s conic.datum (C{Datum}).
@return: A L{LatLonDatum3Tuple}C{(lat, lon, datum)}.
@raise TypeError: If B{C{datum}} is not ellipsoidal. ''' if datum in (None, self.conic.datum): r = LatLonDatum3Tuple(self.latlon.lat, self.latlon.lon, self.conic.datum, name=self.name) else: r = self.toLatLon(LatLon=None, datum=datum) r = LatLonDatum3Tuple(r.lat, r.lon, r.datum, name=r.name) return r
'''Convert this L{Lcc} to an (ellipsoidal) geodetic point.
@kwarg LatLon: Optional, ellipsoidal class to return the geodetic point (C{LatLon}) or C{None}. @kwarg datum: Optional datum to use, otherwise use this B{C{Lcc}}'s conic.datum (L{Datum}, L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}). @kwarg height: Optional height for the point, overriding the default height (C{meter}). @kwarg LatLon_kwds: Optional, additional B{C{LatLon}} keyword arguments, unused if C{B{LatLon}=None}.
@return: The point (B{C{LatLon}}) or a L{LatLon4Tuple}C{(lat, lon, height, datum)} if B{C{LatLon}} is C{None}.
@raise TypeError: If B{C{LatLon}} or B{C{datum}} is not ellipsoidal or not valid. '''
c = c.toDatum(datum)
while True:
inst=self, name=self.name)
'''Return a string representation of this L{Lcc} position.
@kwarg prec: Optional number of decimals, unstripped (C{int}). @kwarg fmt: Optional, enclosing backets format (C{str}). @kwarg sep: Optional separator between name:values (C{str}). @kwarg m: Optional unit of the height, default meter (C{str}). @kwarg C: Optionally, include name of conic and datum (C{bool}).
@return: This Lcc as "[E:meter, N:meter, H:m, C:Conic.Datum]" (C{str}). ''' t += self.conic.name2, T += _C_,
'''Return a string representation of this L{Lcc} position.
@kwarg prec: Optional number of decimal, unstripped (C{int}). @kwarg sep: Optional separator to join (C{str}) or C{None} to return an unjoined C{tuple} of C{str}s. @kwarg m: Optional height units, default C{meter} (C{str}).
@return: This Lcc as I{"easting nothing"} in C{meter} plus I{" height"} suffixed with B{C{m}} if height is non-zero (C{str}). '''
**Lcc_kwds): '''Convert an (ellipsoidal) geodetic point to a I{Lambert} location.
@arg latlon: Ellipsoidal point (C{LatLon}). @kwarg conic: Optional Lambert projection to use (L{Conic}). @kwarg height: Optional height for the point, overriding the default height (C{meter}). @kwarg Lcc: Optional class to return the I{Lambert} location (L{Lcc}). @kwarg name: Optional B{C{Lcc}} name (C{str}). @kwarg Lcc_kwds: Optional, additional B{C{Lcc}} keyword arguments, ignored if B{C{Lcc}} is C{None}.
@return: The I{Lambert} location (L{Lcc}) or an L{EasNor3Tuple}C{(easting, northing, height)} if C{B{Lcc}=None}.
@raise TypeError: If B{C{latlon}} is not ellipsoidal. '''
Lcc(e, n, h=h, conic=c, **Lcc_kwds)
if __name__ == '__main__':
from pygeodesy.interns import _NL_, _NL_var_
# __doc__ of this file, force all into registery t = _NL_ + Conics.toRepr(all=True) print(_NL_var_.join(t.split(_NL_)))
# **) MIT License # # Copyright (C) 2016-2021 -- mrJean1 at Gmail -- All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. |