def distance(self, coord1, coord2): """Compute the distance using the great circle.""" sinsin_lat = coord1.lat.sin() * coord2.lat.sin() coscos_lat = coord1.lat.cos() * coord2.lat.cos() cos_deltalong = coord1.delta_long(coord2).cos() angle = AngleDeg().acos(sinsin_lat + coscos_lat * cos_deltalong) return angle.dist_from_radius(EARTH_RADIUS)
def distance(self, coord1, coord2): """Compute the distance using the great circle.""" sinsin_lat = coord1.lat.sin() * coord2.lat.sin() coscos_lat = coord1.lat.cos() * coord2.lat.cos() cos_deltalong = coord1.delta_long(coord2).cos() angle = AngleDeg().acos(sinsin_lat + coscos_lat * cos_deltalong) return angle.dist_from_radius(EARTH_RADIUS)
def test_distfromradius(self): """For a radius convert the angle to a distance.""" test_angle = AngleDeg(10.0) dist = test_angle.dist_from_radius(100.0) self.assertAlmostEqual(dist, 17.4532, delta=4)