def testEquatorToSouthPole(self): for lon in [0.0, 15.0, 45.0, 90.0, 180.0, 270.0]: self.assertAlmostEqual( geo.bearing_to( lat1=0.0, lon1=lon, lat2=-90.0, lon2=lon), 180.0)
def bearing_to(self, other): """Computes bearing in degrees to another GNSSFix.""" return geo.bearing_to(self.lat, self.lon, other.lat, other.lon)
def testHonoluluToKualaLumpur(self): self.assertAlmostEqual( geo.bearing_to( lat1=21.3, lon1=-157.816667, lat2=3.133333, lon2=101.683333), -83.20267, places=4)
def testLondonToNewYork(self): self.assertAlmostEqual( geo.bearing_to( lat1=51.507222, lon1=-0.1275, lat2=40.7127, lon2=-74.0059), -71.67013, places=4)
def testEquatorFacingWest(self): self.assertAlmostEqual( geo.bearing_to( lat1=0.0, lon1=0.0, lat2=0.0, lon2=-15.0), -90.0)