@@ -69,6 +69,7 @@ The geometry of the contracted nodes is kept in the edge_gdf DataFrame
6969function simplify_graph (g:: OSMGraph{U, T, W} ) where {U, T, W}
7070 relevant_nodes = collect (endpoints (g. graph))
7171 n_relevant = length (relevant_nodes)
72+ nodes = Dict {T,Node{T}} ()
7273 graph = DiGraph (n_relevant)
7374 weights = similar (g. weights, (n_relevant, n_relevant))
7475 node_coordinates = Vector {Vector{W}} (undef, n_relevant)
@@ -79,9 +80,10 @@ function simplify_graph(g::OSMGraph{U, T, W}) where {U, T, W}
7980 for (new_i, old_i) in enumerate (relevant_nodes)
8081 index_mapping[old_i] = new_i
8182 node_coordinates[new_i] = g. node_coordinates[old_i]
82- node = g. index_to_node[old_i]
83- index_to_node[new_i] = node
84- node_to_index[node] = new_i
83+ osm_id = g. index_to_node[old_i]
84+ nodes[osm_id] = g. nodes[osm_id]
85+ index_to_node[new_i] = osm_id
86+ node_to_index[osm_id] = new_i
8587 end
8688
8789 edges = Dict {NTuple{3,U}, Vector{U}} ()
@@ -106,6 +108,7 @@ function simplify_graph(g::OSMGraph{U, T, W}) where {U, T, W}
106108
107109 return SimplifiedOSMGraph (
108110 g,
111+ nodes,
109112 node_coordinates,
110113 node_to_index,
111114 index_to_node,
0 commit comments