Skip to main content

Hi Guys,

 

Is there a way to sort linear polygon features by spatial continuity and then merge then until they reach an specific size?

 

I have the following features which are basically a polygon which was chopped into different parts by a specific length of its center line.

 

To give you a bit of context, I am basically trying to build a workspace that would split linear complex polygon (as the one below) into parts with a maximum of 1km2. However, these parts have to be continuity and not be multipart as they will be used to make separate enquiries in a website.

 

For example sorting by Easting or Northing wouldn't work here as I would end up with separate parts mainly in the top right corner.

 

Is there a way to do this using FME?

 

Capture8 

Thanks

Can you share your sample input?


@ebygomm​ I have attached a KML. This is the original input. Let me know if you'd like to check the chopped one.


@anamanvil​  If you can assume an average width for your road, then the CenterlineReplacer and Chopper might get you close. Something like:

2020-11-05_11-21-56


@anamanvil​  If you can assume an average width for your road, then the CenterlineReplacer and Chopper might get you close. Something like:

2020-11-05_11-21-56

Thanks @Mark Stoakes, I am doing something similar in order to create the above output, using the chopper and 2DVertexCreator instead of Buffer to split the polygon.

A​fter that I use Topology Builder and Area Builder to create the divided polygon as above.

Even thought the width of the polygon can vary I manage to get good results with the above logic.

T​he problem is ideally I want to aggregate all adjoining parts until reaching a maximum of 1 km2 area. In order to aggregate them, I would first need to sort them spatially. I am using BoundExtractor for this but it does not work for the above scenario when sorting by _xmin. So I was wondering whether there might be a way to sort geometry by spatial continuity and once I manage to do that I would then need to find a way to aggregate them until reaching a max. of 1km2. But I believe this step is easier than sorting it.

Let me know if you have any queries.​


Thanks @Mark Stoakes, I am doing something similar in order to create the above output, using the chopper and 2DVertexCreator instead of Buffer to split the polygon.

A​fter that I use Topology Builder and Area Builder to create the divided polygon as above.

Even thought the width of the polygon can vary I manage to get good results with the above logic.

T​he problem is ideally I want to aggregate all adjoining parts until reaching a maximum of 1 km2 area. In order to aggregate them, I would first need to sort them spatially. I am using BoundExtractor for this but it does not work for the above scenario when sorting by _xmin. So I was wondering whether there might be a way to sort geometry by spatial continuity and once I manage to do that I would then need to find a way to aggregate them until reaching a max. of 1km2. But I believe this step is easier than sorting it.

Let me know if you have any queries.​

@anamanvil​ I was thinking that if you could live with an average road width, then the length you set in the chopper could be based that width. @danatsafe​ looked at a similar problem here, but I don't think this would work in your case. Hard to do in FME I'm afraid


@anamanvil​ I don't have a solution for you, but I think this might be a start. In the attached example workspace (FME 2020.2) I've used TopologyBuilder and the ListBasedFeatureMerger to get a list of the adjacent polygon ids and their areas. I think it should be possible to use the PythonCaller to then build up the list of areas. I'm not that strong on Python, but perhaps @ebygomm​ or someone might take that on. (first time I've found a use for ListBasedFeatureMerger!)

Workspace example:


Reply