2

I have a multi-part polygon with a large number of irregularly-shaped features (>600 features). I would like to split them into smaller sub-features/ segments(?) and assign a unique id to these smaller sub-features. Ideally, I would like to split these features based on the condition that the line/ border between them is straight. However, some of the features hardly have straight lines running through them, so another way to split them could be based on a pre-determined area size.

Is there a function to do this automatically in QGIS? And, what are the steps to do this? I'm using QGIS version 3.4.4-Madeira.

For example, I would like to do something like this and then add a unique id row in the feature table:

Example of feature that has been split into smaller segments

0
  1. Use the polygons to lines tool to convert the polygon borders into lines.
  2. Use the explode lines tool to split the border lines into their separate segments.
  3. Manually select and delete all the border lines except the middle border.
  4. Use the geometry by expression tool to create a perpendicular line at the first vertex of every border line segment. Use an expression like this one, but substitute an appropriate distance value in both places where it says 500. The lines will be twice as long as the distance value.

    make_line( project(make_point($x_at(0),$y_at(0)),500,angle_at_vertex($geometry,0) + 90), project(make_point($x_at(0), $y_at(0)),500, angle_at_vertex($geometry,0) - 90))

  5. Use split with lines to split the original polygon with the perpendicular lines

Note: This method will split the polygon at every vertex. In your example image, it looks like some of the segments are not perfectly straight. To avoid splitting the polygons at the vertices of the not-quite-straight segments, you'll need to do some processing between steps 3 and 4. Experiment with the simplify and snap to geometry tools, or manually remove the extra vertices with the vertex tool.

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.