Skip to content

Split polygon by LineString #2844

@sasos90

Description

@sasos90

Hey!

I am busting my head off for a few days already. So I am trying to split the polygon with the LineStrings and nothing on the internet can really help, as for what I have found is usually using the turf.union(polyLine, line) operation, which clearly is not possible. Union only works with Polygons and i have checked all the version in the past, and I haven't found the way where I could simply provide two lines to union function.
What I usually find is a process like this:

const polyAsLine = turf.polygonToLine(poly);
const unionedLines = turf.union(polyAsLine, line);
const polygonized = turf.polygonize(unionedLines);

So what is the best way to split polygon with the line?
Please help my day :D

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions