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
Any ideas?
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
Any ideas?
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).

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'.

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.

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

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:

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'
)
)
)
)