Created
November 30, 2024 11:40
-
-
Save joaofig/ca56e318a3d876fd4271289fc8bd7b74 to your computer and use it in GitHub Desktop.
Computes the GPS segment list for a map-matched trajectory and the corresponding map polyline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute_gps_segments(unique_df: pd.DataFrame, | |
polyline: np.ndarray) -> List[GpsSegment]: | |
traj = Trajectory(lat=unique_df["match_latitude"].to_numpy(), | |
lon=unique_df["match_longitude"].to_numpy(), | |
time=unique_df["time_stamp"].to_numpy() / 1000.0, | |
ids=unique_df["signal_id"].to_numpy()) | |
map_tree = traj.merge(map_lat=polyline[:, 0], # Latitude | |
map_lon=polyline[:, 1]) # Longitude | |
gps_segments = map_tree.get_segments() | |
return gps_segments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment