Skip to main content
Solved

Proportional class assignment with adjacency constraints

  • May 10, 2016
  • 2 replies
  • 13 views

jdh
Contributor
Forum|alt.badge.img+40

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?

Best answer by takashi

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]

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

takashi
Celebrity
  • Best Answer
  • May 11, 2016

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]


jdh
Contributor
Forum|alt.badge.img+40
  • Author
  • Contributor
  • May 11, 2016

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.