I know how to create points by coordinates with arcpy using the following code:

import arcpy

ptList =[[20.000,43.000],[25.500, 45.085],[26.574, 46.025], [28.131, 48.124]]
pt = arcpy.Point()
ptGeoms = []
for p in ptList:
   pt.X = p[0]
   pt.Y = p[1]

arcpy.CopyFeatures_management(ptGeoms, r"C:\Temp\test.shp")

But in my case, every coordinate pair also has an additional text attribute that needs to be written to the shapefile. What would be the approach?


I suggest to use insert cursor, make sure that the field allready exists in the feature class (AddField if necessary)

ptList =[["value1",(20.000,43.000)],["value2",(25.500, 45.085)],["value3",(26.574, 46.025)], ["value4",(28.131, 48.124)]]

cursor = arcpy.da.InsertCursor('C:/temp/test.shp',
                               ['FieldName', 'SHAPE@XY'])

# Insert new rows that include the field value and a x,y coordinate

for row in ptList:

# Delete cursor object
del cursor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.