Solved

Create Random Points with based Attributes values

  • 10 October 2017
  • 6 replies
  • 24 views

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

icon

Best answer by geosander 10 October 2017, 15:14

View original

6 replies

Userlevel 4

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

Badge

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

Userlevel 4

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

Great find!
Badge +3

@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...

Badge +3

@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

 

 

Badge +3

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