I have a shapefile with 300 origin points for polygons I want to generate. I also have a table with a record for each origin point with attributes for the desired polygon's dimensions and angle of orientation.

Can anyone help me use a script or model builder to run through the points and generate polygon shapefiles based on the existing input?

I can work in ArcGIS 10, ArcGIS Pro, or QGIS.

  • Please decide which desktop GIS you wan to ask about in this question and then describe precisely what you have tried and where you are stuck with that. – PolyGeo Feb 14 '17 at 18:58

In Arcgis 10.

Use a arcpy.da.SearchCursor(...) to iterate over you point geometry. At this time you retrieve you x an y. After, use an Insert cursor to populate the geometry (polygon)... with your calculated offset.

import arcpy

gdb_path = "path_to_gdb.GDB"

name_fc_pts= "point"
name_fc_poly = "poly"

fc_pt = "{0}/{1}".format(gdb_path,name_fc_pts)

if not arcpy.Exists(fc_poly):
        arcpy.CreateFeatureclass_management(gdb_path,name_fc_poly,"POLYGON",fc_pt,None,None,arcpy.SpatialReference(32198)) # you must set you projection EPSG
    arcpy.TruncateTable_management(fc_poly) # to clear your previous result (optional)

cursor_poly = arcpy.da.InsertCursor(fc_poly, ["SHAPE@"])

with arcpy.da.SearchCursor(fc_pt, ["SHAPE@XY"]) as cursor_pt:
    for row_pt in cursor_pt:
        pt_x = float(row_pt[0][0])
        pt_y = float(row_pt[0][1])

        print pt_x,pt_y

        array = arcpy.Array([arcpy.Point(pt_x, pt_y),  
                 arcpy.Point(pt_x + 500, pt_y),
                 arcpy.Point(pt_x + 500, pt_y + 200)]         )

    del row_pt

del cursor_poly
| improve this answer | |
  • This works for me - I was hoping for a native tool, I feel like ArcGIS used to have one. I'll make this work. – dwight Feb 15 '17 at 19:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.