I have a shapefile in which a bunch of the lines are multipart. Sometimes this is due to joining ways that are not quite connected (gap less than a foot of real-world distance) and sometimes the endpoints of each part are at exactly the same place (thanks to snapping before joining).

This is really annoying because it means that splitting does not work properly, among other lesser problems.

I've tried every suggestion I've come across. GRASS v.clean.snap with tolerance 1 does nothing. Exporting to KML and removing the gaps in the KML file works but only if the parts are in the correct order and direction (otherwise I get garbage connecting lines). Exporting to GPX completely fails because GPX can only handle single-part lines.

Am I missing something here? Why does this problem even exist? I understand why it happens when there is a slight gap, but I can't see any situation in which joining two topologically connected ways in a multipart line is a feature rather than a bug.

Here (click "Click here to start download from sendspace") is a shapefile with two multipart lines. I-85 has a tiny gap (at the state line), while I-795 connects perfectly yet has three parts. Does anyone have a solution for this, one that can be batch-applied to a file with many lines?

  • throw up a shared link for the kml sourcefile (or a piece of it) – boulder_ruby Jul 14 '14 at 0:48
  • What do you mean by 'the kml sourcefile'? My source was National Highway Planning Network GIS data, with a bit of aerial tracing on I-795. – NE2 Jul 14 '14 at 1:46
  • Your shapefile has only two records, one for each road. This doesn't appear at first glance to be multipart. – boulder_ruby Jul 15 '14 at 1:02
  • @boulder_ruby: open it in QGIS and enable editing. Select the 'node tool', click on a way, and hover over a node. Note how a number is given for a polyline and a vertex. In addition, split I-795 near its midpoint (where it has few nodes). Note how it was not only split where expected but also off to the north where a polyline ends. This is the most annoying symptom of the problem. – NE2 Jul 15 '14 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.