ArcPy Geometry – Converting Multipart Polygon Geometry with True Curves to Single Parts in ArcGIS Pro

arcgis-proarcpygeometrysingleparttrue-curves

I ran some test code below which creates four feature classes in a test geodatabase using ArcPy geometries in ArcGIS Pro 2.9.2:

  • MultiPartPolyGeom has one multipart polygon with two parts (one a 3-sided polygon and the other a 4-sided polygon)
  • CircleGeom has one circular polygon which is a true curve
  • IntersectGeom is the intersection of MultiPartPolyGeom and CircleGeom and is a multipart polygon with two parts – each of those parts has one side which is a true curve
  • IntersectSinglePartGeom is intended to be the two parts of IntersectGeom exploded to create two single part polygons each with one side which is a true curve

import arcpy

if arcpy.Exists(r"C:\temp\test.gdb"):
    arcpy.Delete_management(r"C:\temp\test.gdb")
arcpy.CreateFileGDB_management(r"C:\temp","test")
arcpy.env.workspace = r"C:\temp\test.gdb"

sr = arcpy.SpatialReference("WGS 1984")

coordLists = [[(1.1,2.4),(4.9,2.6),(3.2,7.3)],
              [(6.1,8.8),(5.2,7.6),(7.1,2.3),(9.1,5.3)]]

arrayList = []
for coordList in coordLists:
    arrayList.append(
            arcpy.Array([arcpy.Point(*coords) for coords in coordList]))
multiPartPolyGeom = arcpy.Polygon(arcpy.Array(arrayList),sr)
arcpy.CopyFeatures_management(multiPartPolyGeom,"MultiPartPolyGeom")

circleCenter = arcpy.Point(5, 3)
circleCenterGeom = arcpy.PointGeometry(circleCenter,sr)
circleGeom = circleCenterGeom.buffer(3)
arcpy.CopyFeatures_management(circleGeom,"CircleGeom")

intersectGeom = circleGeom.intersect(multiPartPolyGeom,4)
arcpy.CopyFeatures_management(intersectGeom,"IntersectGeom")

intersectGeomList = []
for i in range(0,intersectGeom.partCount):
    intersectGeomList.append(
        arcpy.Polygon(
            arcpy.Array(intersectGeom.getPart(i)),sr))
arcpy.CopyFeatures_management(intersectGeomList,"IntersectSinglePartGeom")

After running the above code I added the resultant feature classes to a Map in ArcGIS Pro 2.9.2:

enter image description here

Although I expected IntersectSinglePartGeom (the purple feature class) to retain the two true curves from IntersectGeom (the green feature class) they collapsed to a straight edge.

When I first wrote this code and used it at about ArcGIS Pro 2.2 the two true curves were retained.

Consequently, I plan to report this as a bug to Esri Technical Support but assuming it is a bug can anyone anyone think of a workaround which will enable me to to get my expected result of IntersectSinglePartGeom retaining the two true curves?

Best Answer

One easy workaround to this is to use the Multipart To Singlepart tool instead of the Array and getPart by using this code:

arcpy.management.MultipartToSinglepart("IntersectGeom", "IntersectGeomSinglePartTrueCurve")

That retained the two true curves in the output:

enter image description here

Alternatively, as commented by @bixb0012:

If you want to manually alter geometries with true curves using ArcPy, the only option is to manipulate Esri JSON and use the arcpy.Geometry.JSON property and arcpy.AsShape function. Since geoprocessing tools do work with true curves, the identified workaround [above] may actually be a better path overall.