-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FMM trajectories do not match start and end points #237
Comments
If your data is in unit of degrees, the current configuration is too large. Try to reduce radius and GPS error by a factor of 1e-5(1 degree=1e5 meters, 1 meter = 1e-5 degree)。 Keep all units in degrees if you do not want to project your GPS and network data into meters. |
Thanks for the quick response. I also tried reduced parameters and various others (also for delta and vmax) but always facing the same issue. It seems to me that the trajectory points are only located at nodes and break points of edges. Thus, points in the middle of an edge are not matched. Can it be related to the network files? I have generated the network files by using this snippet: def save_graph_shapefile_directional(G, filepath=None, encoding="utf-8"):
# default filepath if none was provided
if filepath is None:
filepath = os.path.join(ox.settings.data_folder, "graph_shapefile")
# if save folder does not already exist, create it (shapefiles
# get saved as set of files)
if not filepath == "" and not os.path.exists(filepath):
os.makedirs(filepath)
filepath_nodes = os.path.join(filepath, "nodes.shp")
filepath_edges = os.path.join(filepath, "edges.shp")
# convert undirected graph to gdfs and stringify non-numeric columns
gdf_nodes, gdf_edges = ox.utils_graph.graph_to_gdfs(G)
gdf_nodes = ox.io._stringify_nonnumeric_cols(gdf_nodes)
gdf_edges = ox.io._stringify_nonnumeric_cols(gdf_edges)
# We need an unique ID for each edge
gdf_edges["fid"] = np.arange(0, gdf_edges.shape[0], dtype='int')
# save the nodes and edges as separate ESRI shapefiles
gdf_nodes.to_file(filepath_nodes, encoding=encoding)
gdf_edges.to_file(filepath_edges, encoding=encoding)
print("osmnx version",ox.__version__)
# Download by a bounding box
boundary_polygon = Polygon(coordinates)
G = ox.graph_from_polygon(boundary_polygon, network_type='drive')
start_time = time.time()
save_graph_shapefile_directional(G, filepath='./network-new')
print("--- %s seconds ---" % (time.time() - start_time)) |
You could try other search radius and gps error, also check the direction of each edge to assure the direction of edge is consistent with the GPS movement. |
FMM fits quite well except for the start and end points of the trajectories. As seen on the picture, the map matched trajectory (red) starts at the nearest node instead of the starting point of the original trajectory (black). Any suggestion on that?
I am using a script similar to the provided example:
The text was updated successfully, but these errors were encountered: