AnsweredAssumed Answered

Creating Polygons from Coordinates

Question asked by gshdet on Oct 23, 2012
Latest reply on Oct 24, 2012 by Wayne_Whitley
Hello,

I am hoping for some help.

I am trying to create polygons from coordinates but the code i am using is not working correctly.

Please can someone point me in the right direction? I have tried everything example i have found on the internet.

Thank you

    coordList.append(str(row.getvalue(desc.OIDFieldName)) + "," +str(FirstVertexXpoint) + "," + str(FirstVertexYpoint))
    coordList.append(str(row.getvalue(desc.OIDFieldName)) + "," +str(ThirdVertexXpoint) + "," + str(ThirdVertexYpoint))
    coordList.append(str(row.getvalue(desc.OIDFieldName)) + "," +str(SecondVertexXpoint) + "," + str(SecondVertexYpoint))
    coordList.append(str(row.getvalue(desc.OIDFieldName)) + "," +str(FourthVertexXpoint) + "," + str(FourthVertexYpoint))
    coordList.append(str(row.getvalue(desc.OIDFieldName)) + "," +str(FirstVertexXpoint) + "," + str(FirstVertexYpoint))


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

for feature in coordList:
     coordinates = string.split(feature,",")

     point.ID = coordinates[0]
     point.X = coordinates[1]
     point.Y = coordinates[2]
     array.add(point)

     polygon = arcpy.Polygon(array)
     #array.removeAll()

     featureList.append(polygon)
     #array.removeAll()

arcpy.CopyFeatures_management(featureList, "c:/polygons.shp")

Outcomes