Question

Creating polygons that contain the same number of points

  • 30 July 2019
  • 1 reply
  • 6 views

Hi there, I have a shapefile layer containing 1500 points. I want to create a shapefile layer of 5 polygons in which all 5 polygons contain the same number of points for some data analysis work. I did try using the 'Cluster' transformer (which I could have then digitised around by hand) but each cluster contained a random number of points. Does anyone know how I could do this please?


1 reply

Userlevel 4
Badge +25

Try the SpatialSorter (an FME Hub transformer).

You need to set a group size, rather than number of groups, but you can easily calculate that with a StatisticsCalculator and ExpressionEvaluator (or just go with 300 as a fixed value).

Additionally, if you look at the FME Desktop training course, chapter 3 has a set of exercises that carry out this exact task (taking all the addresses in Vancouver and generating 5 different garbage collection zones), so maybe that would be worth a look: https://s3.amazonaws.com/gitbook/Desktop-Basic-2019/DesktopBasic3WorkspaceDesign/3.00.WorkspaceDesign.html

In fact you could download the workspace for that exercise and see if it can be used directly with your data! You can get the workspaces/data from here: https://s3.amazonaws.com/FMEData/FMEData2019.zip (it's quite a large file)

Reply