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 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) polyArray.add(newPoint) newPoly = arcpy.Polygon(polyArray) list_of_values = [key_value for key_value in attributes ] insertData = newPoly, object_id insertCursor.insertRow(insertData)
Nothing is recorded in the feature class.