AnsweredAssumed Answered

Create Polygons from Lat and Long coordinates through Python

Question asked by 924216004 on Apr 8, 2014
Latest reply on Apr 9, 2014 by crafty762
I have a problem. I want to create polygons by using the X and Y values from a CSV file. I have borrowed a script and edited to work with my data. The only problem is the script runs for only one set of values. Not both. I have a location and from the location it draws a polygon that is 20000 square feet and it does not recognise the second set of coordinates.

I believe I am missing a split line? Or not.

import arcpy, csv, os
from arcpy import env

env.overwriteOutput = True
infile = "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\XY_EVENT_.csv"

point = arcpy.Point()
array = arcpy.Array()
featureList= []

curXY = arcpy.da.SearchCursor(infile, ["X","Y"])

for row in curXY:
    X = float (row[1])
    Y = float (row[0])
    highX = X+ 148.7
    highY = Y + 134.5
    array = arcpy.Array([arcpy.Point(X, Y), arcpy.Point(highX, Y),
    arcpy.Point(highX, highY), arcpy.Point(X, highY), arcpy.Point(X, Y)])

polygon = arcpy.Polygon(array)

arcpy.CopyFeatures_management(featureList, "U:\Tax\Special Projects\JEFitzgerald\CUVA\Test\Test_CUVA.gdb\Poly33")


print arcpy.GetMessages()