How to use the movingpandas.geometry_utils.calculate_initial_compass_bearing function in movingpandas

To help you get started, we’ve selected a few movingpandas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anitagraser / movingpandas / tests / test_geometry_utils.py View on Github external
def test_compass_bearing_west(self):
        assert calculate_initial_compass_bearing(Point(0, 0), Point(-10, 0)) == 270
github anitagraser / movingpandas / tests / test_geometry_utils.py View on Github external
def test_compass_bearing_east(self):
        assert calculate_initial_compass_bearing(Point(0, 0), Point(10, 0)) == 90
github anitagraser / movingpandas / tests / test_geometry_utils.py View on Github external
def test_compass_bearing_north(self):
        assert calculate_initial_compass_bearing(Point(0, 0), Point(0, 10)) == 0
github anitagraser / movingpandas / tests / test_geometry_utils.py View on Github external
def test_compass_bearing_south(self):
        assert calculate_initial_compass_bearing(Point(0, 0), Point(0, -10)) == 180
github anitagraser / movingpandas / movingpandas / trajectory.py View on Github external
def get_direction(self):
        """
        Return the direction of the trajectory.

        The direction is calculated between the trajectory's start and end location.
        Direction values are in degrees, starting North turning clockwise.

        Returns
        -------
        float
            Direction of the trajectory in degrees
        """
        pt0 = self.get_start_location()
        pt1 = self.get_end_location()
        if self.is_latlon:
            return calculate_initial_compass_bearing(pt0, pt1)
        else:
            return azimuth(pt0, pt1)
github anitagraser / movingpandas / movingpandas / trajectory.py View on Github external
def _compute_heading(self, row):
        pt0 = row['prev_pt']
        pt1 = row[self.get_geom_column_name()]
        if not isinstance(pt0, Point):
            return 0.0
        if pt0 == pt1:
            return 0.0
        if self.is_latlon:
            return calculate_initial_compass_bearing(pt0, pt1)
        else:
            return azimuth(pt0, pt1)