QGIS Python R – Split Polygon into Features Where It Intersects with Points/Lines

pythonqgisr

I have a polygon that represents the area surveyed over a line (a buffer with 1.5m of width). The points represent the start of a "substrate type" observed during the survey, e.g. the white point represents the start of rocky substrate and the green point represent the start of sandy bottom (and hence, the end of rocky substrate).

I want to divide this polygon, so that I can represent continuously the substrate type (and not by points) by generating a "split" polygon in which each feature represents a substrate type.

enter image description here

So basically, I want to split the polygon where it intersects with the points.

I have found a way to split the polygon into equal parts with equal areas. However, I couldn't yet find the solution to my problem. Something that I thought would be quite easy to do in QGIS is turning into a nightmare! Somehow I can't find any algorithm to do so. I have also tried different functions in R and python but I can't seem to find a solution.

I have also generated manually a new line shapefile representing the point where I would like my polygon to be split:

enter image description here

But, again, I am stuck and I can't find a way to split the polygon where it intersects with the lines.

Does anyone have any idea how I could proceed?

Best Answer

From each point, get the closest point on the boudary of the polygon and connect this one with the point itself. Extend the line on both sides for a small distance, long enough to cross both sides of the buffer. Use these auxiliary lines to split the buffer, using Menu Processing > Toolbox > Split with lines.

The auxiliary lines can be created with Menu Processing > Toolbox > Geometry by expression, using the point layer as input. Use this expression:

extend (
    make_line (
        $geometry,
        closest_point (
            overlay_nearest (
                'polygon', -- replace this with the name of your polygon layer
                boundary($geometry))[0],
        $geometry)
    ),
    1,  -- adapt the length of the auxiliary lines to your needs
    1 -- adapt the length of the auxiliary lines to your needs
)

Auxiliary lines in black (here create with Geoemtry generator for visualization puropse) used to split the polygon: enter image description here

Related Question