I noticed that, when I create a OSMGraph object like this:
using LightOSM
data = download_osm_network(:bbox; minlat=52.89, minlon=-1.2, maxlat=52.92, maxlon=-1.165)
g = graph_from_object(data, weight_type=:distance)
the values of g.node_to_way would contain every way the corresponding key is part of twice. I believe I narrowed it down to the fact, that in this case above, largest_connected_component=true.
So when rebuilding the mappings in trim_to_largest_connected_component!(...) we would again call add_node_and_edge_mappings!(...), which only adds to the dict, without checking if the ways have already been added.
I fixed this problem, by explicitly converting and then collecting the values of g.node_to_way to a set, at the end of every call to add_node_and_edge_mappings!(...)
I noticed that, when I create a OSMGraph object like this:
the values of
g.node_to_way
would contain every way the corresponding key is part of twice. I believe I narrowed it down to the fact, that in this case above,largest_connected_component=true
. So when rebuilding the mappings intrim_to_largest_connected_component!(...)
we would again calladd_node_and_edge_mappings!(...)
, which only adds to the dict, without checking if the ways have already been added.I fixed this problem, by explicitly converting and then collecting the values of g.node_to_way to a set, at the end of every call to
add_node_and_edge_mappings!(...)