Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
x = self._x / r
y = 2 * atan(exp(self._y / r)) - PI_2
if datum is not None:
_xinstanceof(Datum, datum=datum)
E = datum.ellipsoid
if not E.isEllipsoidal:
raise _IsnotError(_ellipsoidal_, datum=datum)
#
y = y / r
if E.e:
y -= E.e * atanh(E.e * tanh(y)) # == E.es_atanh(tanh(y))
y *= E.a
x *= E.a / r
r = LatLon2Tuple(Lat(degrees90(y)), Lon(degrees180(x)))
return self._xnamed(r)
def reset(self, lat0, lon0):
'''Set or reset the center point of this azimuthal projection.
@arg lat0: Center point latitude (C{degrees90}).
@arg lon0: Center point longitude (C{degrees180}).
@raise RangeError: Invalid B{C{lat0}} or B{C{lon0}}.
@raise UnitError: Invalid B{C{lat0}} or B{C{lon0}}.
'''
self._latlon0 = LatLon2Tuple(Lat( lat0, name=_lat0_),
Lon(_norm180(lon0), name=_lon0_))
self._sc0 = tuple(sincos2d(self.lat0))
self._radius = None
def _2fllh(lat, lon, height=None):
'''(INTERNAL) Convert lat, lon, height.
'''
# lat, lon = parseDMS2(lat, lon)
return (Lat(lat, Error=WGRSError),
Lon(lon, Error=WGRSError), height)
def _2fll(lat, lon, *unused):
'''(INTERNAL) Convert lat, lon.
'''
# lat, lon = parseDMS2(lat, lon)
return (Lat(lat, Error=GARSError),
Lon(lon, Error=GARSError))
def _2fll(lat, lon, *unused):
'''(INTERNAL) Convert lat, lon to 2-tuple of floats.
'''
# lat, lon = parseDMS2(lat, lon)
return (Lat(lat, Error=GeohashError),
Lon(lon, Error=GeohashError))
g, precision = _2garstr2(garef)
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))