How to use the pygeodesy.named._xnamed function in PyGeodesy

To help you get started, we’ve selected a few PyGeodesy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mrJean1 / PyGeodesy / pygeodesy / webmercator.py View on Github external
def _WM_(strWM, radius, Wm, name):
        w = strWM.replace(_COMMA_, _SPACE_).strip().split()

        if len(w) == 2:
            w += [radius]
        elif len(w) != 3:
            raise ValueError
        x, y, r = map(float, w)

        r = EasNorRadius3Tuple(x, y, r) if Wm is None else \
                            Wm(x, y, radius=r)
        return _xnamed(r, name)
github mrJean1 / PyGeodesy / pygeodesy / osgr.py View on Github external
0 > N or N > 12:
                raise ValueError

            g = s.split()
            if len(g) == 1:  # no whitespace
                e, n = halfs2(s)
            elif len(g) == 2:
                e, n = g
            else:
                raise ValueError

            e = _s2i(E, e)
            n = _s2i(N, n)

        r = _EasNor2Tuple(e, n) if Osgr is None else Osgr(e, n)
        return _xnamed(r, name)
github mrJean1 / PyGeodesy / pygeodesy / wgrs.py View on Github external
m, p = 6, precision - 1
        for i in range(_BaseLen, _BaseLen + p):
            lon = _digit(lon, g, i,     m)
            lat = _digit(lat, g, i + p, m)
            u *= m
            m  = _Base
        u *= _Tile

    if center:
        lon = lon * 2 + 1
        lat = lat * 2 + 1
        u *= 2
    u = _Tile / u
    r = LatLonPrec3Tuple(Lat(lat * u, Error=WGRSError),
                         Lon(lon * u, Error=WGRSError), precision)
    return _xnamed(r, nameof(georef))
github mrJean1 / PyGeodesy / pygeodesy / ellipsoidalNvector.py View on Github external
       @raise ValueError: Insufficient number of B{C{points}}.
    '''
    _, points = _Nvll.points2(points, closed=False)
    # geographic mean
    m = sumOf(p._N_vector for p in points)
    lat, lon, h = m._N_vector.latlonheight

    if height is not None:
        h = height
    if LatLon is None:
        r = LatLon3Tuple(lat, lon, h)
    else:
        kwds = _xkwds(LatLon_kwds, height=h, datum=datum)
        r = LatLon(lat, lon, **kwds)
    return _xnamed(r, meanOf.__name__)
github mrJean1 / PyGeodesy / pygeodesy / utm.py View on Github external
def _toXtm8(Xtm, z, lat, x, y, B, d, c, k, f,  # PYCHOK 13+ args
                 name, latlon, eps, Error=UTMError):
    '''(INTERNAL) Helper for L{toEtm8} and L{toUtm8}.
    '''
    h = _hemi(lat)
    if f:
        x, y = _false2(x, y, h)
    if Xtm is None:  # DEPRECATED
        r = UtmUps8Tuple(z, h, x, y, B, d, c, k, Error=Error)
    else:
        r = Xtm(z, h, x, y, band=B, datum=d, falsed=f, convergence=c, scale=k)
        if isinstance(latlon, _LLEB) and d is latlon.datum:
            r._latlon_to(latlon, eps, f)  # XXX weakref(latlon)?
            latlon._convergence = c
            latlon._scale = k
    return _xnamed(r, name)
github mrJean1 / PyGeodesy / pygeodesy / lcc.py View on Github external
_xinstanceof(_LLEB, latlon=latlon)

    a, b = latlon.philam
    c = conic.toDatum(latlon.datum)

    t = c._n * (b - c._lam0) - c._opt3
    st, ct = sincos2(t)

    r = c._rdef(c._tdef(a))
    e = c._E0         + r * st
    n = c._N0 + c._r0 - r * ct

    h = latlon.height if height is None else height
    r = EasNor3Tuple(e, n, h) if Lcc is None else \
                 Lcc(e, n, h=h, conic=c, **Lcc_kwds)
    return _xnamed(r, name or nameof(latlon))
github mrJean1 / PyGeodesy / pygeodesy / osgr.py View on Github external
def _latlon3(self, LatLon, datum):
        '''(INTERNAL) Convert cached latlon to C{LatLon}
        '''
        ll = self._latlon
        if LatLon is None:
            r = _ll2datum(ll, datum, LatLonDatum3Tuple.__name__)
            r = LatLonDatum3Tuple(r.lat, r.lon, r.datum)
        else:  # must be ellipsoidal
            _xsubclassof(_LLEB, LatLon=LatLon)
            r = _ll2datum(ll, datum, LatLon.__name__)
            r = LatLon(r.lat, r.lon, datum=r.datum)
        return _xnamed(r, ll)
github mrJean1 / PyGeodesy / pygeodesy / points.py View on Github external
           @kwarg Nvector: Optional class to return the C{n-vector}
                           components (C{Nvector}) or C{None}.
           @kwarg Nvector_kwds: Optional, additional B{C{Nvector}} keyword
                                arguments, ignored if B{C{Nvector=None}}.

           @return: The C{n-vector} components B{C{Nvector}} or if
                    B{C{Nvector}} is C{None}, a L{Vector4Tuple}C{(x,
                    y, z, h)}.

           @raise TypeError: Invalid B{C{Nvector}} or B{C{Nvector_kwds}}.
        '''
        x, y, z = latlon2n_xyz(self.lat, self.lon)
        r = Vector4Tuple(x, y, z, self.height if h is None else h)
        if Nvector:
            r = Nvector(x, y, z, h=r.h, **_xkwds(Nvector_kwds, ll=self))
        return _xnamed(r, self.name)

github mrJean1 / PyGeodesy / pygeodesy / gars.py View on Github external
lon = _ll(_Digits,  g,       0, _LonLen, 1, 720) + _LonOrig_M1_1
    lat = _ll(_Letters, g, _LonLen, _MinLen, 0, 359) + _LatOrig_M1
    if precision > 0:
        lon, lat = _ll2(lon, lat, g, _MinLen, _M2)
        if precision > 1:
            lon, lat = _ll2(lon, lat, g, _MinLen + 1, _M3)

    if center:  # ll = (ll * 2 + 1) / 2
        lon += 0.5
        lat += 0.5

    r = _Resolutions[precision]  # == 1.0 / unit
    r = LatLonPrec3Tuple(Lat(lat * r, Error=GARSError),
                         Lon(lon * r, Error=GARSError), precision)
    return _xnamed(r, nameof(garef))