def Inverse3(self, lat1, lon1, lat2, lon2): # PYCHOK outmask '''Return the distance in C{meter} and the forward and reverse azimuths in C{degrees}. ''' m = self.DISTANCE | self.AZIMUTH d = self.Inverse(lat1, lon1, lat2, lon2, m) return Distance3Tuple(d.s12, wrap360(d.azi1), wrap360(d.azi2))
def _inverse(self, other, azis, wrap): '''(INTERNAL) Inverse Karney method. @raise TypeError: The B{C{other}} point is not L{LatLon}. @raise ValueError: If this and the B{C{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. @arg lat: Latitude (C{degrees}). @arg 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.0 # ... lon [-180, 180) i.e. -180 <= lon < 180 return Zone(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
def _direct(self, distance, bearing, LL, height): '''(INTERNAL) Karney's C{Direct} method. @return: A L{Destination2Tuple}C{(destination, final)} or a L{Destination3Tuple}C{(lat, lon, final)} if B{C{LL}} is C{None}. ''' g = self.datum.ellipsoid.geodesic r = g.Direct3(self.lat, self.lon, bearing, distance) if LL: h = self.height if height is None else height d = LL(wrap90(r.lat), wrap180(r.lon), height=h, datum=self.datum) r = Destination2Tuple(self._xnamed(d), wrap360(r.final)) return r