I want to import a road network into grass gis to run network analyses. I use "v.in.ogr" to import my road shapefile. The problem is that Grass GIS seems to split every crossing line no matter if they share a common node or not. Line split

For a road network this is problematic for bridges or tunnels. How can I prevent the lines from being split? I'd like to preserve the line as in the following image:

Line not split

Lines that belong together have the same id.

Which commands will lead to my desired result?

1 Answer 1


I think you will have to use something like v.build.polyline.

From the manual page:

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.

...[polylines] sometimes [are] broken into their constituent straight line segments during conversion from one data format to another. v.build.polylines can be used to rebuild such broken polylines.

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. Dec 1, 2014 at 22:56
  • 1
    @SS_Rebelious Actually, it may. The problem with v.in.ogr appears to be that it's creating vertices (or actually, nodes) at every line intersection, whether both share a vertex/node or not. It appears v.build.polyline will actually bring them in as polylines and not cut the lines where they cross unless there is already a vertex/node of the same line type there. I'm not overly familiar with GRASS and if this would work, but a quick review of the help files on the two commands seems to indicate it's at least going in the right direction.
    – Chris W
    Dec 1, 2014 at 23:29
  • Unfortunately, v.build.polyline doesn't solve the problem because the line segments are still split. All segments of one line have the same "cat" number so in theory they can be identified. Is there no way to tell the v.in.ogr command not to split polylines? Dec 9, 2014 at 8:45
  • It may be good for you to add what you plan on doing with the data to your question then. Dec 9, 2014 at 19:33

Your Answer

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

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