WeeklyAlteryxTips#32 Create a random point in the polygon


This post is about Spatial function.

How to create a random point by Alteryx Designer

You might want to create many random points within the polygon to make test data or do simulation. So, you can use ST_RandomPoint function for creating a random point in the Formula tool.

For example, I create a polygon on the Map Input tool. Here is the Imperial palace in Japan.

After that, you use the ST_RandomPoint function, you can get a random point as follows.

But you can only one random point! In this case, I think you often want to create many random points. If so, it is very easy. In that case, you need to use the Gerenate Row tool. This way is to generate polygons by the Generate Row and then use the ST_RandomPoint function as follows. If you want 1000 random points, you need to make 1000 rows by the Generate Row tool.

Only bad point is that the source outer polygon is increasing, so the data is getting bigger.

Please delete unnecessary outer polygon field as soon as possible. The result of creating 1000 random points is as follows.

Sample Workflow download

Next Blog Post

The tips will be about Browse tool.


Copied title and URL