1

I want to make each separate individual feature layer based on list of OBJECTID of one feature layer. And I want the name of each feature layer to be sequential (e.g.: 1, 2, 3, 4..)

So far I already have this:

list_a = []
a = ''    
selection = 0
selection = len(arcpy.Describe(fc).FIDSet)
if selection < 0:
    sys.exit

rows = arcpy.da.SearchCursor (fc, 'OBJECTID')
for row in rows:
    list_a.append(row[0])
    a = a + str(row[0]) + ';'

for OID in a:
    fc_i = "Feature Class {}".format(OID)
    arcpy.MakeFeatureLayer_management(fc_path, fc_i, "OBJECTID = " + str(OID))

I get the error of this:

  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 7682, in MakeFeatureLayer
    raise e
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 7679, in MakeFeatureLayer
    retval = convertArcObjectToPythonObject(gp.MakeFeatureLayer_management(*gp_fixargs((in_features, out_layer, where_clause, workspace, field_info), True)))
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 511, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError:

Do you have a solution for this problem? Also the I still haven't figured out how to make the feature layers name to be Feature Class 1, Feature Class 2, Feature Class 3,...

2

0

Your Answer

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

Browse other questions tagged or ask your own question.