Building polygons (predrawn) at randomly generated points

161
2
10-21-2020 10:11 PM
Server
by
New Contributor II

Hello, 

I have a bit of an odd question. I currently have a point dataset that has been randomly generated over a land base. I want to create a set of polygons at said points, corresponding to an area field, where each polygon will be 1, 2, 3 or 4 hectares in size (this is done in a random fashion). I am able to achieve this by either using the buffer tool or by using the table to ellipse tool (where I need the major and minor axis), and simply adding a field within my point features which determines which size the polygon will be, and then creating an if statement that builds the size of the buffer/table to ellipse based on this...

My question is, I am looking to find a way to generate polygons at these points that are not perfectly circular or an ellipse. I have a set of 4 pre-drawn polygon shapes (oblong/uneven shapes that are not exactly buffers/ellipse) which I would like to map at the same location of these points. Again, these polygons would be randomly set to each point, with a random designation of 1,2,3, or 4 hectares. 

I have 100s-1000s of points, so I would like to automate this, but I have not found anything that would be appropriate for this problem (other than a simple buffer or table to ellipse). I figure it would be some sort of copy operation, where a polygon is copied from a template, and then built at the point, but I'm not sure how to accomplish this. 

Again, a fairly odd problem, but I just want to cover my bases by asking the net. 

Thanks in advance!

0 Kudos
2 Replies
DavidPike
MVP Frequent Contributor

Hi,

All in code -  I would probably turn your points into a set of simple polygons (squares etc), the next step would be to run an update cursor over each feature and replace the geometry array via a calculation (add 10 metres West, minus 30 metres North etc.) based on the current coordinates of the vertices, a bit of trial and error with the output shape.  To make it random, you could have a random selection from a list of possible manipulations to the coordinates).

JoshuaBixby
MVP Esteemed Contributor

I could see starting with 3 feature classes:  one containing points, one containing template polygons, and one for storing the output shapes for the points.

Use a cursor on the template polygon feature class to create a tuple/list containing tuples/lists of the following information.  Something like:

templates = (
    (shape@, (xshift, yshift)),
    ....
)‍‍‍‍

The shape@ is the geometry itself, and the (xshift, yshift) tuple contains the pre-computed amount you need to shift from the point to have the centroid of the template polygon centered on the point (I assume you want the template shape roughly centered on the point).

Then, I would take a cursor and loop through the point feature class to get the coordinates for inserting the templates into the output feature class using an insert cursor.