Solved

How can split polygon (rivers/roads) into branch?


Badge +1

How can split polygon into branch like this image?

Each branch showed by a number. 

imageAnd the split positions are yellow lines like this

imageEveryone has any ideas to solve this my issue, please show with me! Thank you so much!

icon

Best answer by geomancer 26 April 2022, 17:34

View original

10 replies

Badge +4

Hi @pqtkha​ ,

have you try the PolygonCutter transformer? My example:

imageResult:

image 

Userlevel 4
Badge +36

Good idea! But the challenge is probably in creating the lines to use in the PolygonCutter.

I've experimented a bit with some simple data to set up a basic workflow. There's still work to be done though!

Split_Roads_Polygon

Badge +1

Hi @pqtkha​ ,

have you try the PolygonCutter transformer? My example:

imageResult:

image 

Thank for your recommend! I tried the PolygonCutter Transformer but before that I have to extract the line which use to split the polygon. I need all step are automate processing from the input data!

Userlevel 4
Badge +26

Another option is to use the the VertexAngleCalculator. This will create points where a vertex between two lines is greater than a chosen amount. You can then use the NeighborFinder in Candidates only mode to find the closet point (within a given distance).

imageThe result will not be perfect because of having to pick an angle but could probably be improved on.

 

Here's an example: Input

imageOutput

image 

Badge +1

Good idea! But the challenge is probably in creating the lines to use in the PolygonCutter.

I've experimented a bit with some simple data to set up a basic workflow. There's still work to be done though!

Split_Roads_Polygon

Wow, That great! Your ideas to solve this issue is amazing. I tried your workflow with your demo data. It's really work. I also tried with the real data with bigger scale and I saw a new issue that is the time to process at step NeighborFinder so long. I think because the number of neighbors to find assigned to number vertices is so small for each time to find. I attach my small demo data in below, you can test with your workflow. In fact, my data will bigger than 4 - 5 time with this demo data.

imageI greatly appreciate your helping!

Badge +1

Another option is to use the the VertexAngleCalculator. This will create points where a vertex between two lines is greater than a chosen amount. You can then use the NeighborFinder in Candidates only mode to find the closet point (within a given distance).

imageThe result will not be perfect because of having to pick an angle but could probably be improved on.

 

Here's an example: Input

imageOutput

image 

Thanks for your suggestion on this issue. In your workflow from VertexCreator Tranformer to PolygonCutter that output of VertexCreator is points, but assigned to lines of PolygonCutter. Can you help me to clear more your idea! thank you so much!

I attach my demo data in below, you can use in workflow!

Userlevel 4
Badge +26

Thanks for your suggestion on this issue. In your workflow from VertexCreator Tranformer to PolygonCutter that output of VertexCreator is points, but assigned to lines of PolygonCutter. Can you help me to clear more your idea! thank you so much!

I attach my demo data in below, you can use in workflow!

Yeah I tested the input and it seems the VertexAngleCalculator doesn't work so well with polygons with holes in them. Plus I also see that the input has some intersections where the angles are pretty shallow.

Here the VertexCreator is adding in an additional point to a point making a line.

Userlevel 4
Badge +36

I had not thought of the VertexAngleCalculator to identify possible locations of cutting lines. Good idea!

Other possibilities to get the angles at the vertices are the TopologyBuilder and the Intersector transformers.

Badge +1

I had not thought of the VertexAngleCalculator to identify possible locations of cutting lines. Good idea!

Other possibilities to get the angles at the vertices are the TopologyBuilder and the Intersector transformers.

I'm trying improve the workflow base on your ideas! If you have any new idea to solve this issue, please share with me! I really appreciate your help! Thank you so much!

Userlevel 4
Badge +36

I had not thought of the VertexAngleCalculator to identify possible locations of cutting lines. Good idea!

Other possibilities to get the angles at the vertices are the TopologyBuilder and the Intersector transformers.

I've been looking at a couple of ideas for improvement as well. They all look great with simple data, but so far they don't work with real data.

One thing I found out was that the PolygonCutter is way too slow. The best solution I found for this was to use an Intersector and an AreaBuilder, and next remove the original holes.

Split_Roads_Polygon_Drop_Holes

Reply