import arcpy
sr = arcpy.SpatialReference(4326)

# Create polygon 2 x 2 with LL corner at 0,0...
coords = [[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]]
polygon = arcpy.Polygon(arcpy.Array([arcpy.Point(*a) for a in coords]), sr)
arcpy.CopyFeatures_management(polygon, r"C:\Temp\polygon.shp")

# Create point inside the polygon...
point = arcpy.PointGeometry(arcpy.Point(1, 1), sr)
arcpy.CopyFeatures_management(point, r"C:\Temp\point.shp")

I can quickly create a polygon object using a nested list comprehension statement within the arcpy.Array function and use it as a parameter in the CopyFeatures geoprocessing tool (as shown above).

I can quickly create a feature class with a single point object also shown above, again using the CopyFeatures geoprocessing tool.

Is it possible to create a "point" feature class from the "coords" list variable using a similar nested list comprehension approach?

For example, I tried with the following but obviously something is not right here.

point = arcpy.PointGeometry(arcpy.Array([arcpy.Point(*a) for a in coords[:-1]]), sr)

Just trying to make a quick one-liner without resorting to the arcpy.da.InsertCursor method if possible.

1 Answer 1


Pass arcpy.Point to arcpy.PointGeometry:

coords = [[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]]
points = [arcpy.PointGeometry(arcpy.Point(*c),sr) for c in coords]
  • 1
    Ooh! I never thought of doing it like that. That's a cool, efficient strategy to add to my arsenal.
    – Tom
    Jan 7, 2019 at 15:54

Your Answer

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

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