AnsweredAssumed Answered

In ArcMap Pro, how to get data from a selected layer

Question asked by jdgraham on Apr 30, 2019
Latest reply on May 29, 2019 by jdgraham

I am using python in ArcPro and relearning a few things.

I have a feature selected in the dataframe.  I want to determine the name of that layer that has a selection and return the value of the selected object in the field called "GNIS_Name" .  

 

 

aprx = arcpy.mp.ArcGISProject("CURRENT")

#get selected layer
m = aprx.listMaps(aprx)
refLyr = m.listLayers(aprx)
sel_lyrs = refLyr.getSelectionSet(aprx)

# get name of selected stream   
Stream_Name = arcpy.da.SearchCursor(sel_lyrs, "GNIS_Name", "Any value", "")

currently I get the error on line 5: 'list' object has no attribute 'listLayers'

Outcomes