1

I am wondering if it is possible in QGIS to cut a polygon using a centerline (polyline which represents its "median" line) that contains different values. An example is reported in this

Image.

Any ideas?

Taras
  • 32,823
  • 4
  • 66
  • 137
Phalaen
  • 13
  • 3
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short [tour] for more about how the site works – Ian Turton Sep 15 '22 at 15:52
  • 1
    It's certainly possible, but it might require some work. Your first step is to choose a platform, since questions which reference two software stacks are in effect two questions, which violates "One question per Question" policy emphasized in the the [Tour]. – Vince Sep 15 '22 at 16:02

2 Answers2

3

In QGIS you can use the transect tool to create lines perpendicular to your median line, dissolve the transects, then split the polygon with the dissolved layer. The whole process looks something like this:

First, confirm that your line has vertices where you expect the splitting to occur using the vertex tool (make layer editable, then select tool and click & drag rectangle around layer). Vertices

Next, measure the width of your polygon layer along the minor axis, then run the 'Transect' function using the width measurement to inform the length of the transects and set the side to create transects to 'both'. enter image description here enter image description here

Now use the selection tool to select only the transect lines that intersect your polygon and run the 'Dissolve' function on that layer with the selected features only option checked. enter image description here enter image description here

Finally, use the dissolved transects to cut the polygon via the 'Split with Lines' function. enter image description here enter image description here

Kartograaf
  • 2,902
  • 7
  • 23
2

Use "Geometry Generator" or "Geometry by expression" (see here for differences) with the expression below on the line layer.

Red outlined: initial polygon; polygons outlined in blue and with blue gradient fill are created by the expression: enter image description here

Use this expression and replace polygon in line 8 with the name of the polygon layer and adapt the buffer size to a value a bit larger than the length of the polygon's transect:

collect_geometries (
    array_foreach (
        generate_series (
            1, 
            num_geometries (segments_to_lines ($geometry))
        ),
        intersection (
            overlay_nearest ('polygon', $geometry)[0],
            buffer (
                geometry_n (segments_to_lines ($geometry), @element),
                120,  -- change buffer size
                cap:='flat', 
                join:='bevel'
            )
        )
    )
)
Taras
  • 32,823
  • 4
  • 66
  • 137
Babel
  • 71,072
  • 14
  • 78
  • 208
  • 1
    +1 for using an expression. I looked at using a buffered line like this but decided against it because of the weird overlap that results at the inflection point of the polyline and the implications of that pattern if the input data meander from straight – Kartograaf Sep 15 '22 at 21:07