Skip to main content

I'm using the following flow and getting two different results:

0684Q00000ArC8bQAF.png

The flow uses a cutting line and gives back the original (un)cut results. The polygon for this example is:

POLYGON((145055.748 479705.959,145059.802 479704.301,145060.003 479704.791,145061.669 479704.11,145061.468 479703.619,145079.166 479696.383,145084.101 479708.452,145066.422 479715.682,145066.222 479715.191,145064.556 479715.872,145064.756 479716.363,145047.05 479723.604,145046.285 479721.734,145043.203 479722.994,145042.471 479721.338,145039.139 479722.701,145038.458 479721.035,145035.116 479722.401,145034.481 479720.846,145014.358 479729.074,145012.216 479723.836,145013.891 479723.15,145012.653 479720.124,145008.46 479721.838,145002.488 479719.333,144994.651 479700.17,144989.025 479702.474,144968.486 479652.247,144971.54 479650.998,145020.56 479630.952,145021.696 479633.729,145039.976 479626.254,145038.841 479623.477,145046.477 479620.354,145072.687 479684.501,145050.657 479693.509,145052.257 479697.422,145055.748 479705.959),(145008.472 479694.522,144996.605 479699.371,145004.11 479717.725,145008.471 479719.555,145011.855 479718.171,145011.166 479716.486,145016.553 479714.283,145011.227 479701.26,145008.472 479694.522))

0684Q00000ArC8NQAV.png

I want to cut from A to B with a single straight line. What i except when i cut it is that, at the end of the flow i would end up with just 1 polygon cause there is no real cutting done with just a single line.

LINESTRING(145003.6683401 479703.20131098,145060.55372605 479700.82006226)

Like this.

But when using the following line i get 2 results in the tester_3:

LINESTRING(145007.78416728 479701.58189224,145062.46469331 479696.46661722)

With a very very tiny area

POLYGON ((145011.227 479701.26,145016.553 479714.283,145011.227 479701.26))

It looks a bit random cause about 50% of the drawn lines it gives the expected geometry back, in the other cases it returns the very tiny wrong object. Any ideas on preventing to get the tiny area back without losing a real tiny area that was really cut off?

Or could this be a thing in the PolygonCutter itself? @lars_de_vries

Hi @JeroenR, is your desired result a single polygon having a pseudo hole which is connected to the exterior boundary, like this? If so, the PolygonCutter may not work as your expected. Firstly check if the resulting 'Cut' feature from the PolygonCutter has your desired geometry.

0684Q00000ArKxkQAF.png

POLYGON ((145052.2568150839 479697.42154776456,145052.257 479697.422,145055.748 479705.959,145059.802 479704.301,145060.003 479704.791,145061.669 479704.11,145061.468 479703.619,145079.166 479696.383,145084.101 479708.452,145066.422 479715.682,145066.222 479715.191,145064.556 479715.872,145064.756 479716.363,145047.05 479723.604,145046.285 479721.734,145043.203 479722.994,145042.471 479721.338,145039.139 479722.701,145038.458 479721.035,145035.116 479722.401,145034.481 479720.846,145014.358 479729.074,145012.216 479723.836,145013.891 479723.15,145012.653 479720.124,145008.46 479721.838,145002.488 479719.333,144994.651 479700.17,144989.025 479702.474,144968.486 479652.247,144971.54 479650.998,145020.56 479630.952,145021.696 479633.729,145039.976 479626.254,145038.841 479623.477,145046.477 479620.354,145072.687 479684.501,145050.657 479693.509,145052.2568150839 479697.42154776456,145011.22692942564 479701.2598273938,145008.472 479694.522,144996.605 479699.371,145004.11 479717.725,145008.471 479719.555,145011.855 479718.171,145011.166 479716.486,145016.553 479714.283,145011.227 479701.26,145011.22692942564 479701.2598273938,145052.2568150839 479697.42154776456))

 


No, a pseudo hole is not my desired result. For this scenario it should just be the original without a cut or the leftover polygon mentioned in my OP. Only when it would be a real cut (like below) it should cut the polygon in two. Like below.


I made an example workflow showing the results. Any idea how to fix the second input line?

testcutter.fmw

Edit:See comment of Takashi for the solution.


I made an example workflow showing the results. Any idea how to fix the second input line?

testcutter.fmw

Edit:See comment of Takashi for the solution.

Since the Line 1 and the Line 2 don't fully across the polygon, naturally the PolygonCutter would not work as expected. You got a correct result with the Line 3, I don't know what is the problem.

 

 


I made an example workflow showing the results. Any idea how to fix the second input line?

testcutter.fmw

Edit:See comment of Takashi for the solution.

I'm building a tool that does not know if the input line is correct or not. Its just an 'random' straight input line that could. Possible swcenario's:

 

 

A: Cutting line does not touch the polygon - Expected result: No cut, original polygon is returned dWorks as expected]

 

B: make a clean cut (like line 3) - Expected result: Two cuts(or more), resulting polygons returned eWorks as expected]

 

C: touches it but no cut can be made - Expected result: No cut, original polygon is returned. eWorks as expected]

 

D: Cuting donut (Line 1, in my example, works as i would like to see it work, line 2 does not and creates a weird very small and not logical polygon) - Expected result: No cut, original polygon is returned

 

 

So i need to think of something that would always return the original polygon if polygon with donut(s) is not completely cut in two. Only scenario D gives an unwanted results a x % of the time.

 

 


I made an example workflow showing the results. Any idea how to fix the second input line?

testcutter.fmw

Edit:See comment of Takashi for the solution.

In the PolygonCutter, the boundary of polygon would be divided at intersections between a line and the boundary. Even if the line didn't cut the polygon, the output polygon would not be exactly the same as the input one, since some extra vertices (intersections) would be inserted to the boundary. As you have observed, sometimes tiny polygons could also be generated when overlaying the resulting polygon and the original polygon , because of computational error.

 

As a workaround, I think you can filter out lines that don't fully cross the polygon beforehand.Overlay a line and an area (only its outer shell if the area was a donut) with the LineOnAreaOverlayr, then the line would be divided at intersections between the line and the polygon boundary. If the number of the divided lines is greater than 2 and also is odd, you can determine that the line fully crosses the area.

 

This workspace example illustrates my intention: filter-lines-fully-crossing-area.fmw (FME 2018.0.1.1)

 

Hope this helps.

 

 


I made an example workflow showing the results. Any idea how to fix the second input line?

testcutter.fmw

Edit:See comment of Takashi for the solution.

Update. This workspace example selects only a line fully crossing an area and cuts the area by the line.

 

area-cutter-demo.fmw (FME 2018.0.1.1)
Update. This workspace example selects only a line fully crossing an area and cuts the area by the line.

 

area-cutter-demo.fmw (FME 2018.0.1.1)
This works. Thanks!

 

 


Reply