Skip to main content

Hi All,

I have a polygon that I want to split by a line feature. I'm rather surprised to find out that there don't seem to be any tools that do this, or at least, none I've found yet. There are a lot of questions about this, but no consistent answers, or simple way of doing it.

Clipper - The Clipper feature needs to be an Area. Mine is a line.

LineOnAreaOverlayer - splits the line, not the area. :-/

Intersector - output is lines that don't reflect input areas nicely.

So, have I missed something? Is there a transformer for doing this? This is GIS 101 level geometry handling, so I'd be surprised if there isn't, but where is it hiding?

Thanks

A way of doing this (and it is not as straight forward as 1 transformer):

Create lines from the area (GeometryCoercer) and do a InterSector (use the line output).

Then use an AreaBuilder to recreate the areas from the intersected lines.


Let's say if there was no transformer I would clip the lines with the polygons, use the chopper on the polygons with a number 2 for the maximum number of vertices. merge all the lines (the clipped ones and the results from the polygons) then rebuild the polygons with the new lines with the area builder.

If I want to get back the attributes from the original polygons, I would use the AreaOnAreaOverlayer transformer.

 

 

Perhaps there are other more easier methods to do so.

I agree that it's an odd gap.

 

I have a custom transformer that does this, that unfortunately I can't share but essentially uses a TopopolyBuilder followed by an AreaBuilder on the lines then some spatial filtering to transfer the attributes from the original polygon (and drop any constructed polygons that do not have an equivalent orginal)
Thanks for the responses. I've submitted an idea here: https://knowledge.safe.com/idea/46814/transformer-to-split-a-polygon-by-line.html

 


Similar to @erik_jan . I coerce the area geometries to lines, LineOnLineOverlayer followed by an Area Builder. As long as the lines don't share any attribute names with the lines then using the accumulation mode 'merge incoming attributes' will preserve all the original attributes associated with the areas


Similar to @erik_jan . I coerce the area geometries to lines, LineOnLineOverlayer followed by an Area Builder. As long as the lines don't share any attribute names with the lines then using the accumulation mode 'merge incoming attributes' will preserve all the original attributes associated with the areas

An easy fix for that is to remove all attributes from the lines just prior to the LineOnLineOverlayer.

Another way is to create a topology with Topology builder (Input = your lines + polygons), then from the output "Edges" you recreate polygon and you keep only the polygons that are within the original ones...


Thanks for the responses. I've submitted an idea here: https://knowledge.safe.com/idea/46814/transformer-to-split-a-polygon-by-line.html

 

Thanks. Yes that's odd that we don't already have that functionality. There is a request already to split the areas in a LineOnAreaOverlayer, filed as PR#62406 with our developers. I'm going to post a comment there that links to this thread and the idea. The PR priority is already very high, so I can't really increase it any more. But it does mean we might get to this sooner rather than later.

 


@Jonathan Like already stated on the Ideas page: I created a custom transformer with the name PolygonCutter. You can find it on the FME HUB. Just click here


I'm please to let you know that the LineOnAreaOverlayer has a new mode for splitting areas with lines. This is available in FME 2023.0 betas: www.safe.com/beta


I'm please to let you know that the LineOnAreaOverlayer has a new mode for splitting areas with lines. This is available in FME 2023.0 betas: www.safe.com/beta

That is good news. I just checked and our custom transformer to do this was written in 2012, so I'm expecting some improved performance with the LOAO mode.


Reply