Hello
I am running this code on AGOL Notebook but I am getting error. The code is from Esri website
https://support.esri.com/en/technical-article/000016853
I don't know why I am getting this error:
Hi @anonymous55,
Have u tried working with for loops and/or list indexes?
In the example, they probably have only 1 webmap and 1 feature layer. If you have multiple webmaps en feature layers, the result of gis.content.search will be stored as a list.
To extract all feature layer URLs you can for example try:
for i in fcs: print(i.url)
It is also possible to work with list indices.
Hope this will help you out.
This is exact code on blog except I am running it on Notbook on arcgis online. Then I didn't provide password and a portal url just user name
import arcgis from arcgis.gis import GIS user = "UserName" ##My User name ##for web maps webmaps = gis.content.search("owner:" + user, item_type="Web Map", max_items=10) webmaps ##for feature layers fcs = gis.content.search("owner:" + user, item_type="Feature Layer", max_items=10) fcs ##for feature layers fcs.url fc_layers = fcs.layers fc_layers.url ##for web maps web_map_obj = arcgis.mapping.WebMap(webmaps) maplayers = web_map_obj['operationalLayers'] maplayers['url']
what did you provide for steps 1 and 2 in your link?
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.