Dear ESRI community,
How do you use ArcGIS API for python to specify a layer in a web map based on the layers title? All of the samples I've seen just use the layer at index 0. I can't find any samples that search for a particular layer. For example:
my_webmap = gis.content.search(query="title:Trees",item_type="Web Map")
my_item = my_content[0]
wm = WebMap(my_item)
Taxon_layer = wm.layers[0] #I want to select the layer where "Title" = "Taxon"
Taxon_layer
===============================================
Out:
{
"id": "Markup_X_3074",
"layerType": "ArcGISFeatureLayer",
"url": "https://services5.arcgis.com/wkEdAXzuNvKdAtLV/arcgis/rest/services/Markup_X/FeatureServer/0",
"visibility": true,
"opacity": 1,
"title": "Taxon",
"itemId": "b022f56ae0c347019ca2c9aae60c450c"
}
Ultimately, I want to iterate through several web maps and modify a particular layer in each web map . The title is always the same but the index number will change each time. I know how to iterate, but I don't know how to select a layer based on title.
Any assistance greatly appreciated
Regards, Damian