Solved

Identify self intersecting polygons along with spikes


Badge

I have a dateset of polygons which I know includes some anomalies such as self-intersecting and spikes. I'd like to identify these and if possible count the number of instances of each type in a report.

 

I have tried following the FME guide on self-intersecting polygons but it does not seem to be working as I expected on my dataset. I'm not sure if its my setting in the GeometryValidator transformer or my base data that is at fault.

 

Any guidance would be much appreciated.

 

I'll include some images of the types of issues I'd like to identify along with the workbench I created and some sample data:

image image image 

icon

Best answer by dustin 21 July 2022, 16:49

View original

7 replies

Userlevel 3
Badge +26

For the spikes:

Have a look at the SpikeRemover transformer, specifically the Remove Spike Iteratively parameter. I've never actually used that transformer, but the language in the documentation seems like it might help you.

 

If you don't actually want to change the geometry but the SpikeRemover gives you useful information about the spike count, you could give the features a UniqueID either with the UUIDGenerator or the Counter. Then after you have extracted the spike count , relate it back to the original feature using FeatureMerger.

 

-OR-

 

You could extract the original geometry first using the GeometryExtractor, then after getting the spike info, replace the geometry with the original using GeometryReplacer.

 

For the self-intersections (bowties):

I would have thought the GeometryValidator would have called these out using the Self-Intersection in 2d. Did you set the parameter for Check for Self-touching polygons to Yes?image

Badge

For the spikes:

Have a look at the SpikeRemover transformer, specifically the Remove Spike Iteratively parameter. I've never actually used that transformer, but the language in the documentation seems like it might help you.

 

If you don't actually want to change the geometry but the SpikeRemover gives you useful information about the spike count, you could give the features a UniqueID either with the UUIDGenerator or the Counter. Then after you have extracted the spike count , relate it back to the original feature using FeatureMerger.

 

-OR-

 

You could extract the original geometry first using the GeometryExtractor, then after getting the spike info, replace the geometry with the original using GeometryReplacer.

 

For the self-intersections (bowties):

I would have thought the GeometryValidator would have called these out using the Self-Intersection in 2d. Did you set the parameter for Check for Self-touching polygons to Yes?image

HI, thanks for the suggestion but I don't think that will resolve my query. I'd like to identify them only, not remove them.... unless I've misunderstood

Badge

For the spikes:

Have a look at the SpikeRemover transformer, specifically the Remove Spike Iteratively parameter. I've never actually used that transformer, but the language in the documentation seems like it might help you.

 

If you don't actually want to change the geometry but the SpikeRemover gives you useful information about the spike count, you could give the features a UniqueID either with the UUIDGenerator or the Counter. Then after you have extracted the spike count , relate it back to the original feature using FeatureMerger.

 

-OR-

 

You could extract the original geometry first using the GeometryExtractor, then after getting the spike info, replace the geometry with the original using GeometryReplacer.

 

For the self-intersections (bowties):

I would have thought the GeometryValidator would have called these out using the Self-Intersection in 2d. Did you set the parameter for Check for Self-touching polygons to Yes?image

Thanks for the suggestion. I had the Self intersections in 2D set as per your screen grab but it doesn't appear to be working (unless it's something really obvious I'm not seeing)

Userlevel 3
Badge +26

HI, thanks for the suggestion but I don't think that will resolve my query. I'd like to identify them only, not remove them.... unless I've misunderstood

I set up a mock dataset of the spikes, and this workflow should work for you. I've attached the workbench so you can copy in the transformers.

image.png

Userlevel 3
Badge +26

@jez​ I just realized you uploaded your source data. Take a look at this workbench. It should get you pointed in the right direction to calculate both the spike and self-intersects counts.

Badge

@jez​ I just realized you uploaded your source data. Take a look at this workbench. It should get you pointed in the right direction to calculate both the spike and self-intersects counts.

OK... So first off I need to say a very big thank you. This turned out to be much more involved than I anticipated but your workbench works perfectly! Although I understand some of your workbench I feel my FME skillset lacking. How did you know to set the 'Max Spike Angel to 25'? I will be deconstructing this workbench to upskill where I can.

Userlevel 3
Badge +26

@jez​ You are welcome, glad I could help. Angle of 25 was just based on the results I was seeing in your dataset. You may need to tweak that number if you see additional spikes not being counted. The lower the number, the more acute the spike is before it's counted.

Reply