eshehadi

Using Modelbuilder for a Monte Carlo Process

Discussion created by eshehadi on May 28, 2014
Latest reply on May 28, 2014 by eshehadi
Hello,

I would like to create a model or write a script that will complete the following geoprocess:

If I have a layer of polygons, I need to place two random points in each polygon, create a line from those two points, and then check if that line falls within the polygon or not.

I am using ModelBuilder, and I am able to build a model that will create two random points within each polygon and then create a line between them. I am confident that I can figure out how to do the spatial join, but I am not sure how to use that to give me an output that essentially counts if it is inside the polygon or not.

I am unsure how to correctly set up the for - function and collecting the output data that I need.


Pseudocode:

for i=1 to 10000
     Create two random points inside each polygon
     Create line between those two points
     Check if line falls completely within the polygon
     Keep a count for each polygon if the line falls within polygon or not for each round through the loop

end

I figured I would ask if anyone had any examples they might be able to share that accomplished something similar, or if anyone had any suggestions as to how to build this model.

Much appreciated!

Outcomes