Skip to main content

Hello everyone, happy monday to you all,

 

I have a dataset of points on a road network which I am trying to assign to groups of max 300 points. There are two attributes which must be the same for all the points in a certain group.

 

Also, to make the work of our editing team easier, the groups should be sorted by location. For this I am using the SpatialSorter (Hilbert sort in 2D). I am however getting some unexpected results. In the screenshot below I have selected all points in group 1100, also note the scale below to get a rough idea of this dataset:

image.pngThese points seem grouped correctly but they are not all grouped together.

These are the points in group 1101:

imageThere is a large gap between these points (about 25km).

Group 1102 (and a lot more groups for that matter) show the same gap:imageI guess there is some spatial relationship between these points, since they seem to be on roughly the same vertical axis, but it's not as accurate as I would have expected. Any explanation for this? This is what I would have expected, give or take:

image 

I used to calculate the groups using a PythonCaller, but for testing purposes I have omitted the PythonCaller and I still get the same results:imageThe workflow above does not abide to my constraints of the two attributes that must be the same, but my current focus is on getting this SpatialSorter to match my expectations.

 

Any guesses as to why the SpatialSorter is behaving like this? Or maybe alternative workflows that get the same result?

 

Kind regards,

Joep

On second thought, I guess the SpatialSorter is kind of behaving like it is supposed to, and that the nature of my dataset is causing it to not meet my expectations. Although I still feel that there is more emphasis on the x coordinate instead of both the x and y coordinates.


Have you looked at the custom transformer PointClusterer? The version on FME Hub is obsolete (outdated python version), but an updated version is available in this question.

You may be able to adapt the python code inside the transformer for clustering the points to your own needs.


Another option is to use the PointCloudDensityTiler - This one works with Point Clouds but you can still leverage it. I like this method sometimes because it's deterministic and will always give the same results between runs - The PointCluster is really good but because randomness is involved then you will always get different results between runs.

the downside with the DensityTiler is that is used FME's tiling tool and the groups aren't really very natural.


On second thought, I guess the SpatialSorter is kind of behaving like it is supposed to, and that the nature of my dataset is causing it to not meet my expectations. Although I still feel that there is more emphasis on the x coordinate instead of both the x and y coordinates.

Yes, unfortunately that is how spatial sorter works! I've run into the exact same issue you have. The suggestions from @geomancer​  and @virtualcitymatt​  are all good alternatives


Reply