AnsweredAssumed Answered

Create Polygon.shp from Point.shp using Python Code

Question asked by 924216004 on Apr 10, 2014
Latest reply on Apr 11, 2014 by Wayne_Whitley
Hello, I have a question about the code below. Do I create default point and polygon shapefiles or do I neet to add attributes to the point and polygon shapefiles. I have been trying to work on this code and have not been able to get it to work. Not sure about shortList and pointList. This code has been copied from another post.

import arcpy pointFC =  r"C:\Users\whitley-wayne\Desktop\summary\data.gdb\funds" polygonFC = r"C:\Users\whitley-wayne\Desktop\summary\data.gdb\hab60" pointList = []  with arcpy.da.SearchCursor(pointFC, "SHAPE@XY") as cursor:     for row in cursor:         shortList = list(row[0])         pointList.append(shortList)  with arcpy.da.InsertCursor(polygonFC, ["SHAPE@"]) as c:     for pnt in pointList:         #   start with the lower left         lowX = pnt[0]         lowY = pnt[1]         #   find the upper right         highX = lowX + 20         highY = lowY + 20         array = arcpy.Array([arcpy.Point(lowX, lowY),                              arcpy.Point(lowX, highY),                              arcpy.Point(highX, highY),                              arcpy.Point(highX, lowY),                              arcpy.Point(lowX, lowY)])         polygon = arcpy.Polygon(array)         c.insertRow([polygon])

Outcomes