I am trying to create a polygon from a text file that contains latitude and longitude values.
Here is what I have so far:
out_path ="C:/Output"
out_name = "Shapefile.shp"
geometry_type = "POLYGON"
template = "Other.shp"
has_m = "DISABLED"
has_z = "DISABLED"
spatial_reference = arcpy.Describe("Other.shp").spatialReference
arcpy.CreateFeatureclass_management(out_path, out_name, geometry_type, template, has_m, has_z, spatial_reference)
cursor = arcpy.da.InsertCursor("Other.shp", ["SHAPE@"])
array = arcpy.Array()
point = arcpy.Point()
for line in fileinput.input(new_txt):
point.Name, point.X, point.Y = line.split()
line_array.add(point)
polygon = arcpy.Polygon(array)
cursor.insertRow([polygon])
fileinput.close()
del cursor
The Error is:
File line 39
point.Name, point.X, point.Y = line.split()
ValueError: too many values to unpack
Let me know if you need more information.
Here is a screenshot of what the text file looks like: