Perhaps we should consider two steps in loading the network. Because duplicate edges are not allowed we prevent them by adding intermediate vertices along the edge shape, that's probably whats going wrong here. If we work in two steps we could greatly simplify this process:
Load from OSM while allowing duplicate edges.
Postprocess network to remove the duplicates.
This has only advantages:
Performance should be better because it takes some work checking for duplicates and fixing on the fly when adding edges.
This will also benefit the plan to keep orginal id's if needed along with vertices.
The postprocessing code can be shared between IO.Osm and IO.Shape or any other future network loader, now that code it specific for each.
http://geojson.io/#id=gist:anonymous/738e7f8c50dc591b089b4d9d694a0245&map=19/52.51097/4.94420
Perhaps we should consider two steps in loading the network. Because duplicate edges are not allowed we prevent them by adding intermediate vertices along the edge shape, that's probably whats going wrong here. If we work in two steps we could greatly simplify this process:
This has only advantages: