I got the following error
Traceback (most recent call last): File "<string>", line 110, in execute File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\topographic.py", line 1886, in PolygonToCenterline raise e File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\topographic.py", line 1883, in PolygonToCenterline retval = convertArcObjectToPythonObject(gp.PolygonToCenterline_topographic(*gp_fixargs((in_features, out_feature_class, connecting_features), True))) File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda> return lambda *args: val(*gp_fixargs(args, True)) arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds. Failed to execute (PolygonToCenterline). "
when running arcpy.topographic.PolygonToCenterline() in my code.
Line 110 is:
arcpy.topographic.PolygonToCenterline(dissolve_doors, door_lines, None)
the whole block of code is:
def execute(self, parameters, messages
"""The source code of the tool."""
door_layer = parameters[0].valueAsText
door = parameters[1].valueAsText
outFC = parameters[2].valueAsText
# memory delete
arcpy.Delete_management("memory")
#output location
arcpy.AddMessage(outFC)
arcpy.AddMessage(door)
#spatial reference
spatial_reference = arcpy.Describe(door_layer).spatialReference
#multi to single
single_doors = 'memory\\single_doors'
arcpy.management.MultipartToSinglepart(door_layer, single_doors)
#buffer
buffer_doors = 'memory\\buffer_doors'
arcpy.analysis.Buffer(single_doors, buffer_doors, "0.1 Feet","FULL","ROUND","NONE",None,"PLANAR")
floor_list =['xxxx']
for item in floor_list:
#select by attribute
floor_id = "FLOOR_ID = '"+ item + "'"
arcpy.AddMessage(floor_id)
door_selection = arcpy.management.SelectLayerByAttribute(buffer_doors, "NEW_SELECTION", floor_id, None)
#dissolve doors
dissolve_doors = 'memory\\dissolve_doors'
arcpy.management.Dissolve(door_selection, dissolve_doors, None, None, "SINGLE_PART", "DISSOLVE_LINES", "")
#polygon to centerline
door_lines = 'memory\\door_lines2'
arcpy.topographic.PolygonToCenterline(dissolve_doors, door_lines, None)
Solved! Go to Solution.
Work Around:
arcpy.topographic.PolygonToCenterline()
For some reason this geoprocessing tool does not like to be written to memory. When using the code below to create a feature class, it worked fine.
# create output feature class
out_name = os.path.basename(outFC3)
out_path = os.path.dirname(outFC3)
arcpy.management.CreateFeatureclass(out_path, out_name, "POLYLINE", None, "DISABLED", "DISABLED", spatial_reference)
Odd that it does not like being written to memory, definitely something Esri should fix.
Code formatting ... the Community Version - Esri Community
will facilitate getting help
Work Around:
arcpy.topographic.PolygonToCenterline()
For some reason this geoprocessing tool does not like to be written to memory. When using the code below to create a feature class, it worked fine.
# create output feature class
out_name = os.path.basename(outFC3)
out_path = os.path.dirname(outFC3)
arcpy.management.CreateFeatureclass(out_path, out_name, "POLYLINE", None, "DISABLED", "DISABLED", spatial_reference)
Odd that it does not like being written to memory, definitely something Esri should fix.
Hi OveringUMD,
I am a Product Engineer on the ArcGIS Production Mapping and ArcGIS Defense Mapping extensions.
Thank you for bringing this issue to our attention. What version of ArcGIS Pro are you using?
I have reproduced your issue and I have logged a bug in our team repository.
Regards,
Dan
Hi @OveringUMD
I just wanted to let you know that the issue you identified is addressed for ArcGIS Pro 3.3.
Regards.,
Dan