I want to create a toolbox I have a list of point coordinates, that define a polygon and a list of attributes, that each polygon has. points_list = [(323917.71, 479699.45), (323923.36, 479699.74), (323923.89, 479709.52), (323918.24, 479709.23)], attributes = [('ADDRESSID', '5'), ('BUILDINGID', '4'), ('LANDID', '35'), ... ]

I want to insert the information into a feature class. I also want to define the projection, that would be selected by the user, inside the Toolbox.

I have tried:

list_of_fields = [key_value[0] for key_value in attributes ]
insertCursor = arcpy.da.InsertCursor(fc,
                                     ['SHAPE@', list_of_fields], spatial_ref)
polyArray = arcpy.Array()
for pointsPair in points_list:
    newPoint = arcpy.Point(*pointsPair)
newPoly = arcpy.Polygon(polyArray)
list_of_values = [key_value[1] for key_value in attributes ]
insertData = newPoly, object_id

Nothing is recorded in the feature class.

1 Answer 1


I believe the issue is with this line:

insertData = newPoly, object_id

First of all what is object_id? Seems like a completely unrelated object, you want to insert a row that is your polygon and in your example 3 values.

You want to be constructing a tuple like this:

insertData = (newPoly,5,4,35)

Then insert it with:


Also and I appreciate this is a code "snippet" but there is no loop, it's a one time read your your lists attributes and points_list.

  • From the cursor assignment, I think OP was trying to do insertData = [newPoly] + list_of_values, and AFAIK, the list should be fine with InsertCursor.
    – fatih_dur
    Jun 3, 2020 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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