Skip to main content
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


curtisd54
Contributor
Forum|alt.badge.img+4

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

hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • November 22, 2023

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

 


geomancer
Evangelist
Forum|alt.badge.img+48
  • Evangelist
  • November 23, 2023

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()))

 


curtisd54
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • November 23, 2023
hkingsbury wrote:

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


curtisd54
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • November 23, 2023
geomancer wrote:

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.


aron
Supporter
Forum|alt.badge.img+16
  • Supporter
  • November 24, 2023

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.


geomancer
Evangelist
Forum|alt.badge.img+48
  • Evangelist
  • November 24, 2023
geomancer wrote:

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


curtisd54
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • November 24, 2023
aron wrote:

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


curtisd54
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • November 24, 2023
geomancer wrote:

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


curtisd54
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • November 24, 2023
geomancer wrote:

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


hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • November 26, 2023
curtisd54 wrote:

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


curtisd54
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • November 27, 2023
curtisd54 wrote:

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?


hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • November 27, 2023
curtisd54 wrote:

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


geomancer
Evangelist
Forum|alt.badge.img+48
  • Evangelist
  • November 27, 2023
geomancer wrote:

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings