Traceback (appel le plus récent en dernier): Fichier "C: \ Utilisateurs \ Brett \ Bureau \ Jefferson_final.py", ligne 31, en point = arcpy.Point (coordonnée [0], coordonner [1]) IndexError: liste des index hors de portéeJ'essaye de créer ashapefile des coordonnées x, y d'un txt. fichier mais j'obtiens l'erreur suivante
Voici mon script
import arcpy
import fileinput
import os
import string
arcpy.env.workspace = "C:\Users\Brett\Desktop\San Clemente"
arcpy.env.overwriteOutput = True
outFolder = "C:\Users\Brett\Desktop\San Clemente"
output = open("result.txt", "w")
fc = "metersSC1.shp"
inputFile = "C:\Users\Brett\Desktop\San Clemente\San Clemente Lat Long.txt"
name = ""
for line in inputFile:
lineSegment = line.split(": ")
if lineSegment[0]== "spatialReference":
spatRef = spatRef = arcpy.SpatialReference(26946)
arcpy.CreateFeatureclass_management(outFolder, fc, "POINT", "", "", "", spatRef)
arcpy.AddField_management(fc, "NAME", "TEXT")
cursor = arcpy.da.InsertCursor(fc, ["","[email protected]"])
array = arcpy.Array()
elif lineSegment[0] =="NAME":
if len(array) > 0:
polygon = arcpy.Polygon(pointList)
cursor.insertRow((name,polygon))
name = lineSegment[0]
else:
coordinate = line.split(",")
point = arcpy.Point(coordinate[0],coordinate[1])
pointList.add(point)
polygon = arcpy.Polygon(array)
cursor.insertRow((name, polygon))
print "COORDINATES ADDED"