Hello, I have a problem and I am struggling to find the solution, I have several irregular polygons and, in this specific case, I need to extract areas where the width of the polygon is less than 8 meters (limit red lines). Has anyone been through something like this?
Hi @dellinsbc
Could you share us your data or sample?
Thanks in Advance,
Danilo
Hi @dellinsbc
Could you share us your data or sample?
Thanks in Advance,
Danilo
Hi Danilo,
This is a sample of the area under study in shapefile format. Thanks.
INSPEC_AREA_SAMP.zip
Hi @dellinsbc Would buffering by -4 and then again by +4 work for you? See @nathanatsafe 's solution at https://knowledge.safe.com/questions/63563/extract-polygon-with-certain-width.html
Hi @dellinsbc Would buffering by -4 and then again by +4 work for you? See @nathanatsafe 's solution at https://knowledge.safe.com/questions/63563/extract-polygon-with-certain-width.html
Hi, that was my first idea, it doesn't work because it doesn't keep the shape of the area that remains.
Are you trying to get just the polygons highlighted in yellow, or remove the bits highlighted in yellow from the bigger polygons?
This is a particularly difficult task due to the randomness of the angles.
I got quite a few of them to work out. Anything with a 90ish degree angle is close. Attached is the example workbench.
Rotate, generalize to get corner points, chop to get vertex, buffer, count to give buffer unique values, replace buffer with a skeleton, split skeleton, overlay skeleton on polygon to find intersecting corner, test our any records that have more than 1 intersection, extend line, and buffer. From there you can clip. It got most of them. You can use an area calculator to filter the 90 degree angles that are correct. They should almost all be the same area.
8ft_corner_clipper.fmwt
Are you trying to get just the polygons highlighted in yellow, or remove the bits highlighted in yellow from the bigger polygons?
@ebygomm I need to remove the highlighted areas.
This is a particularly difficult task due to the randomness of the angles.
I got quite a few of them to work out. Anything with a 90ish degree angle is close. Attached is the example workbench.
Rotate, generalize to get corner points, chop to get vertex, buffer, count to give buffer unique values, replace buffer with a skeleton, split skeleton, overlay skeleton on polygon to find intersecting corner, test our any records that have more than 1 intersection, extend line, and buffer. From there you can clip. It got most of them. You can use an area calculator to filter the 90 degree angles that are correct. They should almost all be the same area.
8ft_corner_clipper.fmwt
Hi @jlbaker2779
I appreciate the answer, but due to version problems, I was unable to open the file you shared. I tried to reproduce the flow but also without success, because I don't know the parameters of the transformers.
Hi @jlbaker2779
I appreciate the answer, but due to version problems, I was unable to open the file you shared. I tried to reproduce the flow but also without success, because I don't know the parameters of the transformers.
You can download as many versions of FME as you want as parallel installs. Download the beta and install it in the folder with the other one. Then you can open the workbench. Just make sure you don't associate files with the newer version if you don't want it as the default.
https://www.safe.com/support/downloads/#beta
Example; I have 6 versions installed for various reasons.
Hi @dellinsbc, if you make a donut geometry having holes whose boundaries are equal to the original polygons, the AreaAmalgamator transformer might help you to detect parts narrower than a specific width - 8 meters for example.
Smaller 'Maximum Triangle Width' creates more precise result, but takes longer time to process.
Workflow example:
Gray: original polygons, Blue: parts narrower than 8 meters
Hi @dellinsbc, if you make a donut geometry having holes whose boundaries are equal to the original polygons, the AreaAmalgamator transformer might help you to detect parts narrower than a specific width - 8 meters for example.
Smaller 'Maximum Triangle Width' creates more precise result, but takes longer time to process.
Workflow example:
Gray: original polygons, Blue: parts narrower than 8 meters
@takashi that's a very interesting way of identifying narrow sections. Any thoughts on how to adjust it to prevent the corner mitering? I would be interested in something more along the lines of identifying/removing the sections in red, while not touching the blue sections.
Hi @dellinsbc, if you make a donut geometry having holes whose boundaries are equal to the original polygons, the AreaAmalgamator transformer might help you to detect parts narrower than a specific width - 8 meters for example.
Smaller 'Maximum Triangle Width' creates more precise result, but takes longer time to process.
Workflow example:
Gray: original polygons, Blue: parts narrower than 8 meters
Impressive! I completely forgot about the AreaAmalgamator.
@takashi that's a very interesting way of identifying narrow sections. Any thoughts on how to adjust it to prevent the corner mitering? I would be interested in something more along the lines of identifying/removing the sections in red, while not touching the blue sections.
The solution offered by @takashi is already excellent, if there is no way to disregard the corner areas, then it would be perfect. I'm trying to do that, I don't know if I'm going to make it, I'm still new to FME.
Hi @dellinsbc, if you make a donut geometry having holes whose boundaries are equal to the original polygons, the AreaAmalgamator transformer might help you to detect parts narrower than a specific width - 8 meters for example.
Smaller 'Maximum Triangle Width' creates more precise result, but takes longer time to process.
Workflow example:
Gray: original polygons, Blue: parts narrower than 8 meters
@takashi, this helped me a lot. Thank you!
I need to disregard these corner areas, I'm trying, but the most difficult has been solved.
This is a fairly naive approach that will only work on simple polygons (no ellipses, no donuts, no aggregates). It will only cut/remove sections at existing vertices, with a bit of a tolerance for spikes/corners.
This is a fairly naive approach that will only work on simple polygons (no ellipses, no donuts, no aggregates). It will only cut/remove sections at existing vertices, with a bit of a tolerance for spikes/corners.
Could you send a print of the flow with the parameters? My version does not allow to open the file you shared.
Could you send a print of the flow with the parameters? My version does not allow to open the file you shared.
There are two published parameters, Min (the minimum width) and Spike (the spike limit multiplier).
The logic is as follows:
Create a negative buffer of half the minimum width, so that any sections that are too narrow are removed.
Deaggregate the result, keeping the part number as an attribute
Decompose the original polygon into individual vertices.
Calculate the distance between the vertices and the buffered polygon.
Set the type of vertex, within min width 1, else 0.
Set the type of vertex of the previous and next vertices -1: vertex belongs to a different part, 1|0 as above.
Check if vertex is valid: Either the type is 1, or the distance is less than min width * spike multiplier and both adjacent vertices are type 1 (within tolerance).
Rebuild the polygons from the valid vertices (group by UID and part number) and closing them if necessary.
There are two published parameters, Min (the minimum width) and Spike (the spike limit multiplier).
The logic is as follows:
Create a negative buffer of half the minimum width, so that any sections that are too narrow are removed.
Deaggregate the result, keeping the part number as an attribute
Decompose the original polygon into individual vertices.
Calculate the distance between the vertices and the buffered polygon.
Set the type of vertex, within min width 1, else 0.
Set the type of vertex of the previous and next vertices -1: vertex belongs to a different part, 1|0 as above.
Check if vertex is valid: Either the type is 1, or the distance is less than min width * spike multiplier and both adjacent vertices are type 1 (within tolerance).
Rebuild the polygons from the valid vertices (group by UID and part number) and closing them if necessary.
@jdh, From Takahashi's tips, I'm finally getting close to my goal. It is a very specific situation, I even have difficulty detailing what I need. Appreciate your attention.
Could you send a print of the flow with the parameters? My version does not allow to open the file you shared.
@jdh This is exactly what i need! Can You please elaborate a bit more on the Attribute Creator 2 (Adjacent feature handling) transformer, I cant really figure what you did there...Also the spike limit multiplier, what value did you assign?
I tried to download file you uploaded, but it's not linked to anything, I see it as plain text..
Could you send a print of the flow with the parameters? My version does not allow to open the file you shared.
We lost most attachments when the forum got migrated. Unfortunately I no longer have that workspace.
As for the attributecreator with adjacent feature handling, it was setting up a value for the tester since that transformer can't handle adjacent features. It is basically checking whether the previous and next vertices are valid. This is to prevent removing a single vertex at a corner that is too close. ie if the vertex is within the removal tolerance, but the vertices on either side aren't, it's a corner/spike and should be kept. If there are multiple vertices in a row that are in the removal tolerance, then it's a narrow section that should be removed.
Could you send a print of the flow with the parameters? My version does not allow to open the file you shared.
Hi @stefaniliskovic I've fixed the original link and have attached it to this comment for easy reference. cc: @jdh
Could you send a print of the flow with the parameters? My version does not allow to open the file you shared.
Thank you both so much, works like a charm!
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.