def _inverse(self, other, azis, wrap): '''(INTERNAL) Inverse Karney method. @raise TypeError: The other point is not L{LatLon}. @raise ValueError: If this and the I{other} point's L{Datum} ellipsoids are not compatible. ''' g = self.ellipsoids(other).geodesic m = g.DISTANCE if azis: m |= g.AZIMUTH _, lon = unroll180(self.lon, other.lon, wrap=wrap) r = g.Inverse(self.lat, self.lon, other.lat, lon, m) t = r['s12'] if azis: # forward and reverse azimuth t = t, wrap360(r['azi1']), wrap360(r['azi2']) return t
def _to3zll(lat, lon): # imported by .ups, .utm '''Wrap lat- and longitude and determine UTM zone. @param lat: Latitude (C{degrees}). @param lon: Longitude (C{degrees}). @return: 3-Tuple (C{zone, lat, lon}) as (C{int}, C{degrees90}, C{degrees180}) where C{zone} is C{1..60} for UTM. ''' x = wrap360(lon + 180) # use wrap360 to get ... z = int(x) // 6 + 1 # ... longitudinal UTM zone [1, 60] and ... lon = x - 180 # ... lon [-180, 180) i.e. -180 <= lon < 180 return z, wrap90(lat), lon
def _direct(self, distance, bearing, llr, height=None): '''(INTERNAL) Direct Karney method. ''' g = self.datum.ellipsoid.geodesic m = g.AZIMUTH if llr: m |= g.LATITUDE | g.LONGITUDE r = g.Direct(self.lat, self.lon, bearing, distance, m) t = wrap360(r['azi2']) if llr: a, b = wrap90(r['lat2']), wrap180(r['lon2']) h = self.height if height is None else height t = self.classof(a, b, height=h, datum=self.datum), t return t