Skip to main content

Dear All,

I have 6 Polygons in one shapefile with Name Block A to Block F.

Also, I have one excel file for materials location like shown below screenshot.

my aim needs to create a random point within the polygon as per the values mentioned in the table.

For Example:

121 Sand Random points for Block A polygon

6182 Sand Random points for Block B polygon

1 Cement Random points for Block A polygon

210 Cement Random points for Block B polygon

all points if possible one single shp file.

Thanks in Advance

Venu

A possible solution could include

  • Cloner to create multiple features, e.g. 121 Sand features for block A.
  • BoundsExtractor to get min/max X/Y values for the polygon
  • Two RandomNumberGenerators to generate min/max X/Y values inside the bounds and a VertexCreator to create a point based on those values
  • SpatialFilter to check if random point is inside (if not, loop) if the blocks aren't perfectly rectangular and oriented north/south


There already seems to be a custom transformer on FME Hub (by @takashi, unsurprisingly) that might be helpful here.


There already seems to be a custom transformer on FME Hub (by @takashi, unsurprisingly) that might be helpful here.

Great find!

@venu

this will prevent you having to do lots of iterations when using complex shapes:random-point-in-polygons.fmw

No iteration, just setting high enough resolution in grid builder...


@venu

this will prevent you having to do lots of iterations when using complex shapes:random-point-in-polygons.fmw

No iteration, just setting high enough resolution in grid builder...

 

for instance

 

 


refined the workbench to cope with more complex forms.

At resolution of 50 all 100 points are inside in 1 go!

random-point-in-polygons.fmw


Reply