Hi @aviveiro
Would randomly sampled points on a grid be random enough for your purposes?
If yes, you can try coercing the polygons to point clouds using the PointCloudCombiner and setting the point interval parameter as the minimum distance between points. This creates a point cloud (grid) and should ensure potential points will not fall within a minimum distance of each other.
A PointCloudPropertyExtractor and a Python script can be used to determine which points will be randomly sampled. The Python script selects a number of points based on the number of points to create attribute randomly and creates a list for each area. Use a FeatureJoiner/FeatureMerger find the sampled points by joining on the name of the area and point id.
To ensure no points are created within a certain distance of the boundary of the edge of the polygon, try performing a negative buffer using the Bufferer before the polygons are coerced into point clouds.
I have attached a template workspace demonstrating this approach. generaterandompointsinpolygons.fmwt
Edit: I may have misread your post on the first read. If you only need one point per polygon, perhaps you can look at the RandomPointGenerator on the FME Hub?
Hi @aviveiro
Would randomly sampled points on a grid be random enough for your purposes?
If yes, you can try coercing the polygons to point clouds using the PointCloudCombiner and setting the point interval parameter as the minimum distance between points. This creates a point cloud (grid) and should ensure potential points will not fall within a minimum distance of each other.
A PointCloudPropertyExtractor and a Python script can be used to determine which points will be randomly sampled. The Python script selects a number of points based on the number of points to create attribute randomly and creates a list for each area. Use a FeatureJoiner/FeatureMerger find the sampled points by joining on the name of the area and point id.
To ensure no points are created within a certain distance of the boundary of the edge of the polygon, try performing a negative buffer using the Bufferer before the polygons are coerced into point clouds.
I have attached a template workspace demonstrating this approach. generaterandompointsinpolygons.fmwt
Edit: I may have misread your post on the first read. If you only need one point per polygon, perhaps you can look at the RandomPointGenerator on the FME Hub?
Hi @debbiatsafe
Thanks for the reply. I'll review the workspace provided.
To clarify, I have a feature class of forest inventory polygons that I need to create random points within using a pre-defined stratification. So the 53 random points referenced above would need to be in 53 separate polygons that have a LBS-1-Old stratification. Similarly, 30 points need to be created within 30 different forest inventory polygons with the SFWD-3-Mature stratification and so on. Only one random point is permitted per polygon.
In reviewing the RandomPointGenerator, a fixed number of points is entered; however, I need to generate different numbers of random points per stratification as specified in the num_plots field.
Hi @debbiatsafe
Thanks for the reply. I'll review the workspace provided.
To clarify, I have a feature class of forest inventory polygons that I need to create random points within using a pre-defined stratification. So the 53 random points referenced above would need to be in 53 separate polygons that have a LBS-1-Old stratification. Similarly, 30 points need to be created within 30 different forest inventory polygons with the SFWD-3-Mature stratification and so on. Only one random point is permitted per polygon.
In reviewing the RandomPointGenerator, a fixed number of points is entered; however, I need to generate different numbers of random points per stratification as specified in the num_plots field.
The separation will be a tricky story, based on your geometry that might not even be possible to achieve. A grid approach might be a better idea then, generate a 2D Grid with the 2DGridAccumulator and then use a PointOnAreaOverlayer. A NeighborFinder, grouping the points and polygons will give you the distance of each point to the edge of the polygon it's contained by and that should allow you to find out which is the furthest from the edge.