ScottChang25

ArcGIS 10.0:Create Polygons from Points-Runtime Error: List index out of range

Discussion created by ScottChang25 on Sep 10, 2012
Latest reply on Sep 10, 2012 by mzcoyle
Hi all,
In the Python Window of my ArcGIS 10.0, I executed the following code:
>>> import arcpy
... coordList = [[[1.2], [2,4], [3,7]],
...             [[6,8], [5,7], [7,2], [9,5]]]
... point = arcpy.Point()
... array = arcpy.Array()
... featureList = []
... for feature in coordList:
...     for coordPair in feature:
...         point.X = coordPair[0]
...         point.Y = coordPair[1]
...         array.add(point)
...     array.add(array.getObject(0))
...     polygon = arcpy.Polygon(array)
...     array.removeAll()
...     featureList.apend(polygon)
... arcpy.CopyFeatures_management(featureList, "c:/TEMP/PythonWindow10_0/polygons.shp")
... 
Runtime error <type 'exceptions.IndexError'>: list index out of range
>>> 

I have no ideas why I got this runtime error.  Please kindly help, tell me why I got this runtime error: list index out of range and how I can fix it.

Thanks in advance,
Scott Chang

Outcomes