Question

Hello I am looking to implement these rules within my data: eliminating: 1) polygons less than 1m2 2) polygons less than 1m in width 3)duplicate vertices less than 1m apart any help is appreciated. thanks, Curtis

  • 22 November 2023
  • 13 replies
  • 15 views

Badge +3

I have tried an area calculator and area selector for polygons less than 1m2

which appears to work but I wonder if there is a better method


13 replies

Userlevel 5
Badge +29

Rules 1 and 3 are pretty easy to filter for.

 

For rule 1, area calculator followed by a tester or just use the @Area() function in a testerimageFor rule 3 you can use the Generalizer with a generalizing algorithm - https://docs.safe.com/fme/2023.1/html/FME-Form-Documentation/FME-Transformers/Transformers/generalizer.htm

 

Rule 2 is one of those ones that to a human, is really easy, but to a computer is kinda hard. We can look at a polygon and instantly pick its long/short axis, not so easy for a computer. The best way to do something like this is to use the CircularityCalculator. This essentially looks at the ratio of the area to the perimeter of a shape.

 

I've attached an example. In that you can see the more 'circular' the feature is, the closer its circularity 'score' is to 1, as it get stretched (a long and narrow rectangle) the closer the score gets to 0

 

Userlevel 5
Badge +36

Concerning Rule 2: for polygons that are more or less rectangular you can approximate the width with a formula based on Area and Perimeter (which is called Length in FME):

image

@Evaluate(@Length()/4 - @sqrt(((@Length()/4)**2) - @Area()))

 

Badge +3

Rules 1 and 3 are pretty easy to filter for.

 

For rule 1, area calculator followed by a tester or just use the @Area() function in a testerimageFor rule 3 you can use the Generalizer with a generalizing algorithm - https://docs.safe.com/fme/2023.1/html/FME-Form-Documentation/FME-Transformers/Transformers/generalizer.htm

 

Rule 2 is one of those ones that to a human, is really easy, but to a computer is kinda hard. We can look at a polygon and instantly pick its long/short axis, not so easy for a computer. The best way to do something like this is to use the CircularityCalculator. This essentially looks at the ratio of the area to the perimeter of a shape.

 

I've attached an example. In that you can see the more 'circular' the feature is, the closer its circularity 'score' is to 1, as it get stretched (a long and narrow rectangle) the closer the score gets to 0

 

thanks soo much for the answer. I have Rule 1 and 3 running ok now. it is much appreciated!! For Rule 2: how would I connect my data to run through this workflow ? as when I connect incoming data to all the bufferers it duplicates all my data in the CirclarityCalculator outcome?? thanks again

Badge +3

Concerning Rule 2: for polygons that are more or less rectangular you can approximate the width with a formula based on Area and Perimeter (which is called Length in FME):

image

@Evaluate(@Length()/4 - @sqrt(((@Length()/4)**2) - @Area()))

 

this works great! thanks! much appreciated. but I am trying to weed out all the other shapes as shown above.

Userlevel 1
Badge +14

This might help with no2: In the GeometryValidator there is a setting to remove vertices within a given distance. If you set this to 1m the polygons with shorter sides would be output via the repaired stream.

Userlevel 5
Badge +36

Concerning Rule 2: for polygons that are more or less rectangular you can approximate the width with a formula based on Area and Perimeter (which is called Length in FME):

image

@Evaluate(@Length()/4 - @sqrt(((@Length()/4)**2) - @Area()))

 

With this formula you can select the polygons to remove because of rule 2.

Something like this (continue to the Generalizer, as mentioned by hkingsbury):

image

Badge +3

This might help with no2: In the GeometryValidator there is a setting to remove vertices within a given distance. If you set this to 1m the polygons with shorter sides would be output via the repaired stream.

which issue to detect in Geometry Validator are you refering to? I see duplicate consecutive points ? I tried setting that to 1. Or was there another detector ? thanks

Badge +3

With this formula you can select the polygons to remove because of rule 2.

Something like this (continue to the Generalizer, as mentioned by hkingsbury):

image

thanks. Yes I have both of those formulas working . I was just curious as to how i can implement the CirclarityCalculator?  to weed out the different types of shapes which are less than 1m in width

Badge +3

With this formula you can select the polygons to remove because of rule 2.

Something like this (continue to the Generalizer, as mentioned by hkingsbury):

image

with this formula it weeds out the circular features which i do not want to do. I am trying to eliminate slivers under 1m

Userlevel 5
Badge +29

thanks soo much for the answer. I have Rule 1 and 3 running ok now. it is much appreciated!! For Rule 2: how would I connect my data to run through this workflow ? as when I connect incoming data to all the bufferers it duplicates all my data in the CirclarityCalculator outcome?? thanks again

How do you mean duplicates? The features you input into the circularitycalculator are output with a new attribute containing the circularity score

Badge +3

thanks soo much for the answer. I have Rule 1 and 3 running ok now. it is much appreciated!! For Rule 2: how would I connect my data to run through this workflow ? as when I connect incoming data to all the bufferers it duplicates all my data in the CirclarityCalculator outcome?? thanks again

Yes I understand that, but how would I connect the circularity score to my data to find different types of shapes which are under 1m width in size? I think a tester would work based with a similar formula shown below?

Userlevel 5
Badge +29

thanks soo much for the answer. I have Rule 1 and 3 running ok now. it is much appreciated!! For Rule 2: how would I connect my data to run through this workflow ? as when I connect incoming data to all the bufferers it duplicates all my data in the CirclarityCalculator outcome?? thanks again

Yes, you'd use a tester to filter out results with a low circularity score. I'd usually combine it also with a check on the area. Ie if it has a small area and a low circularity score, then its likely a slither polygon

Userlevel 5
Badge +36

With this formula you can select the polygons to remove because of rule 2.

Something like this (continue to the Generalizer, as mentioned by hkingsbury):

image

Maybe it helps to first use the CircularityCalculator, and next remove polygons with a small width that are not circular. Or maybe the circles have an attribute that you can use to exclude them from filtering. Or maybe a totally different approach.

Reply