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])
Solved! Go to Solution.
import arcpy fc= r"U:\\Tax\\Special Projects\\JEFitzgerald\\CUVA\\Test\\Points.shp" polygonFC= r"U:\\Tax\\Special Projects\\JEFitzgerald\\CUVA\Test\\Polygon.shp" pointList=[] ####CODE VERSION#### #for row in arcpy.da.SearchCursor (fc, [ "OID@", "SHAPE@XY"]): #print ("feature {0}:".format(row[0])) #print row[1] #**** CODE ****# with arcpy.da.SearchCursor (fc, ["SHAPE@XY"]) as cursor: for row in cursor: xy = row[0] pointList.append(xy) #print ("{0}, {1}".format(x,y)) with arcpy.da.InsertCursor (polygonFC, ["SHAPE@"]) as U: for pnt in pointList: lowX = pnt[0] lowY = pnt[1] # find the upper right highX = lowX + 163.1935 highY = lowY + 183.831 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) U.insertRow([polygon])
import arcpy fc= r"U:\\Tax\\Special Projects\\JEFitzgerald\\CUVA\\Test\\Points.shp" polygonFC= r"U:\\Tax\\Special Projects\\JEFitzgerald\\CUVA\Test\\Polygon.shp" pointList=[] ####CODE VERSION#### #for row in arcpy.da.SearchCursor (fc, [ "OID@", "SHAPE@XY"]): #print ("feature {0}:".format(row[0])) #print row[1] #**** CODE ****# with arcpy.da.SearchCursor (fc, ["SHAPE@XY"]) as cursor: for row in cursor: xy = row[0] pointList.append(xy) #print ("{0}, {1}".format(x,y)) with arcpy.da.InsertCursor (polygonFC, ["SHAPE@"]) as U: for pnt in pointList: lowX = pnt[0] lowY = pnt[1] # find the upper right highX = lowX + 163.1935 highY = lowY + 183.831 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) U.insertRow([polygon])