Skip to main content

I have a point feature which has been developed based on the polygon ID. All of these points are created at the polygon Centroid, I want to distribute the point randomly within the polygon

Interesting question that can certainly be done in many different ways.

One possible solution where you discard the existing point features:

  1. Send the polygons to the 2DGridAccumulator to create a point grid. Set Group By on the polygon ID and set a suitable density for the grid (attention, specified in ground units according to your coordinate system).
  2. Send the point grid and the polygon to a SpatialFilter to filter out any points that don’t lie inside the polygon. Set the Group By to the polygon ID.
  3. Use a Sampler to retrieve the first, randomized feature. Group By the polygon ID.

Sample polygon with clipped grid and selected, random point (asterisk):

 


Thank you for the response ​@david_r . To be more clear the points have been created through a process in SQL of our health licenses for premises, these points have been linked to the property boundary through their common id Parcel Number. Through this process the points have all been created at the property parcel centroid.

 

I cannot remove the point and run a different process as these points have been given the attribute of the Health License ID so exposing them individually throughout the property boundary is the best outcome I require. Now the points have been established within the property boundary, we are creating a new SQL script to only connect other attributes to this common Health License ID of the now static points.

 

My task is to distribute these static points throughout the property boundary remaining within it. An example would be using the Property boundary of a major shopping mall which contains multiple Food service and many other health licensed premises which would all be spatially contained within the property centroid. The centroid might contain 100 individual spatial point features.

One solution I have been thinking on would be to create a false boundary inside the existing polygon and move the points to this false internal boundary line, then remove that false internal boundary. I don’t know if this is even more impossible than my initial request.


If you’re looking for a truly random approach, I’ve attached an example workspace (2024.1)

 

 

The first part (in the green bookmark) just generates some sample data.

 

The process then extract the min/max bounds of the polygon, and merges these onto the points (FeatureMerger). Note that we’re also creating multiple copies of each point. This is to avoid needing to a loop. You may need to increase this to more than 10 copies (luck dependent).

Next we create a new random X and Y value for each of the points using the min/max bounds from the input polygon.We then replace the geometry with that new point.

Next, test that the new point falls within the original polygon (SpatialFilter). If it does, we then use the Sampler to get the first instance of each point (based on the id). This is where we reduce the multiple copies of each point back to one


Thank you ​@hkingsbury for the Christmas Present. I will give it a go and enjoy the break 


Thank you for the response ​@david_r . To be more clear the points have been created through a process in SQL of our health licenses for premises, these points have been linked to the property boundary through their common id Parcel Number. Through this process the points have all been created at the property parcel centroid.

 

I cannot remove the point and run a different process as these points have been given the attribute of the Health License ID so exposing them individually throughout the property boundary is the best outcome I require. Now the points have been established within the property boundary, we are creating a new SQL script to only connect other attributes to this common Health License ID of the now static points.

If you have a unique polygon ID, you’ll end up with new points containing this ID. You could then simply merge the new points to the existing points over the polygon ID, retaining the new geometry and keeping the “old” point attributes.


Reply