Select to view content in your preferred language

FIDSet method returns empty if layer object is in a group layer

224
3
07-31-2024 07:55 AM
Glasnoct
Occasional Contributor

I was wondering if someone has an answer as to why the arcpy.Describe(lyr).FIDSet method returns an empty string if the lyr object happens to reside in a group layer as opposed to the root of the map contents?

given a layer named "STREETS," if the layer is in the root, the following correctly returns the selected objectIDs

lyr = mp.listLayers('STREETS')[0]

arcpy.Describe(lyr).FIDSet

returns '78878180; 78879544; 78930438'

 

if 'STREETS' is in a group layer 'BaseMap' the lyr is returned fine but the FIDSet method returns an empty string. To successfully return the selected objects I need to pass lyr.longName. Why does the selection not seem to exist for the object the same way the layer's location string does?

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

Layer properties—ArcGIS Pro | Documentation

There are differences in arcpy.Describe and arcpy.da.Describe as noted in the help topic.  Is there a reason that you are using the former?


... sort of retired...
0 Kudos
Glasnoct
Occasional Contributor

Just habit; likely have been running with the former due to its use in examples I found at one point. 

the difference between the two in the documentation just says one returns a string and the other a list and both result in the same discrepancy in the FIDset value. I looked through the documentation some more but see nowhere that explains why the FIDSet disappears once the layer is moved into a group layer even if the exact same layer object is supplied to Describe.

0 Kudos
DanPatterson
MVP Esteemed Contributor

I don't work with these types of situations, but the isGroupLayer and longName seem to be the way as you describe as in the Discussion section here

Layer—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos