Skip to main content

I have a scenario where polygons need to be "randomly" assigned to one of N classes such that no intersecting polygons share the same class and that there are roughly the same number of polygons in each class.

 

 

My initial thought was to use the FeatureColorSetter (Map coloring) to ensure no adjacent features had the same color, and then randomize within each color group to get the total number of classes, but the color groups are in no way proportional. There is a distinct bias towards the lower color_ids.

 

 

If I just randomize the polygons then check for adjacency issues, and re-randomize the problems, I could end up in an infinite loop.

 

 

Thoughts on how to proceed?

Hi @jdh, it's an interesting challenge. I tried it with a SpatialRelator and PythonCaller. Please evaluate the attached workspace: collect-disjoint-polygons.fmw (FME 2016.1) [Updated]


Hi @jdh, it's an interesting challenge. I tried it with a SpatialRelator and PythonCaller. Please evaluate the attached workspace: collect-disjoint-polygons.fmw (FME 2016.1) [Updated]

That's very promising. Thank you.


Reply