3

I have a shapefile with line features. One of my lines was causing problems in a python script and in the QGIS interface it appeared as two segments (one long one with a brief gap between two nodes).

I used the calculator with num_geometries( $geometries) and it showed this entry has two geometries (all the others had one). I imagine this is the problem. Is there any way to fix this and merge them back to a single geometry? Deleting and re-digitizing would be a lot of effort. I didn't see anything in the Validity checker and it didn't complain, but that might be because I messed up a parameter.

The merge tools in QGIS digitizing bar is not relevant. It is for merging multiple features, not multiple gometries in one feature -- it complains I have only one feature selected.

1
  • 1
    Try if explode lines (your selected line) and afterwards a re-merging solves the problem. Multipart to single-part-geometry might be worth a try as well. – Babel May 9 '20 at 18:39
4

You have a multi-line geometry.

You can use the Merge lines algorithm after you have connected the the two parts, so that they form a continuous line.

You can also split the multi-geometry into two (simple) geometries using the Multipart to single parts algorithm, join them (using the Vertex Tool in the Digitizing Toolbar) to form a continuous line and then combine them into one line using the Merge Selected Features tool in the *Advanced digitizing toolbar".

Your Answer

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

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