[Python] Map recovered routes/paths from simplified and consolidated OSMnx graph back to the...

Discussão em 'Python' iniciado por Stack, Abril 16, 2025.

  1. Stack

    Stack Membro Participativo

    I'm currently using OSMnx to retrieve a street graph from OpenStreetMap, before simplifying and consolidating it to reduce its size, like so:

    import osmnx as ox

    road_graph_ox = ox.graph_from_bbox(bbox, network_type="drive", simplify=False)
    road_graph_ox = ox.simplify_graph(road_graph_ox, track_merged=True)
    road_graph_ox = ox.consolidate_intersections(road_graph_ox, tolerance, rebuild_graph=True, dead_ends=True, reconnect_edges=True)


    I then use a map matching algorithm (Python library mappymatch) to recover vehicle trajectories through the simplified and consolidated OSMnx graph based on GPS points.

    My problem now is that I would like to map the results of the map matching algorithm (edges that make up the route/path) back to the original OSMnx graph, that hasn't been simplified and consolidated. After some research, I found the track_merged and reconnect_edges parameters for the simplify and consolidate functions, but I'm not sure if these will help me. Does anyone know how to approach this mapping from simplified and consolidated OSMnx graph back to the original one?

    Continue reading...

Compartilhe esta Página