1

I have a graph representing a road network and I need to clean it before working on it. Problem is that the original shapefile is not clean so when I make the graph I have many useless nodes too close from each other like in this picture:

enter image description here

enter image description here

I have 3 or 4 blobs like that on the map. The edges in those blobs are too short so there are many intersections, thus many nodes. I'm trying to merge the edges for example but I don't know how to locate these parts when I'm coding.

Does anyone have an idea on how to solve this ? I tried osmnx's simplify graph but it did not work; and was considering networkx's contract functions but i dont know how to find the these nodes.

2 Answers 2

0

Try to use v.generalize tool from GRASS. It offers many algorithms that can help you to simplify your line network. Try to test them and see which one can give you the best result for your case. The help above provides explanation about each algorithm which can help you to decide which algorithm is more suitable for you.

You can find v.generalize tool under Processing toolbox -> GRASS -> Vector -> v.generalize

enter image description here

0

If you only want nodes at intersections, I think GRASS 7's v.build.polylines is the simplest and best option.

From the documentation:

"v.build.polyline picks a line and from its start node, walks back as long as exactly one other line of the same type is connected to this node."

Basically, if a node connects only two line segments, it will be removed and the two segments will be merged.

"Polylines provide the most appropriate representation of curved lines when it is important that nodes serve to define topology rather than geometry."

You can find this algorithm in the processing toolbox in QGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.