Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Create Polygons from Lat and Long coordinates through Python

$
0
0
Hello,
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)
featureList.append(polygon)

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




print arcpy.GetMessages()

Viewing all articles
Browse latest Browse all 2485

Trending Articles