Ejemplo n.º 1
0
    def test_heading_deg_ne_and_sw(self):
        lat, lng = self.BATH_LAT, self.BATH_LNG
        north_lat, east_lng = lat + 1, lng + 1
        north_east_position = GeodeticPosition(north_lat, east_lng)
        south_west_position = GeodeticPosition(lat, lng)

        north_east_heading_deg = south_west_position.heading_deg_to(north_east_position)
        south_west_heading_deg = north_east_position.heading_deg_to(south_west_position)

        self.assertAlmostEqual(45, north_east_heading_deg, places=self.heading_accuracy_places)
        self.assertAlmostEqual(225, south_west_heading_deg, places=self.heading_accuracy_places)
Ejemplo n.º 2
0
    def test_heading_deg_to_north_and_south(self):
        lat, lng = self.BATH_LAT, self.BATH_LNG
        north_lat = lat + 1
        south_position = GeodeticPosition(lat, lng)
        north_position = GeodeticPosition(north_lat, lng)

        north_heading_deg = south_position.heading_deg_to(north_position)
        south_heading_deg = north_position.heading_deg_to(south_position)

        self.assertAlmostEqual(0, north_heading_deg, places=self.heading_accuracy_places)
        self.assertAlmostEqual(180, south_heading_deg, places=self.heading_accuracy_places)
Ejemplo n.º 3
0
    def test_heading_deg_to_east_and_west(self):
        lat, lng = self.BATH_LAT, self.BATH_LNG
        east_lng = lng + 1
        west_position = GeodeticPosition(lat, lng)
        east_position = GeodeticPosition(lat, east_lng)

        east_heading_deg = west_position.heading_deg_to(east_position)
        west_heading_deg = east_position.heading_deg_to(west_position)

        self.assertAlmostEqual(90, east_heading_deg, places=self.heading_accuracy_places)
        self.assertAlmostEqual(270, west_heading_deg, places=self.heading_accuracy_places)
Ejemplo n.º 4
0
 def setUp(self, lat=BATH_LAT, lng=BATH_LNG):
     self.position = GeodeticPosition(lat, lng)