I have a toolbox in ArcPro that is creating a csv with list of all layers present in webappliction. Is there a way that I can run that script from FME and get the same result? I cannot access the content of the webmap in FME as I am using SingleSignOn to log in into EsriEnterprise.
Page 1 / 1
It depends, but in general, with a tool in ArcGIS Pro, you are able to get the Python code and you can put this in a PythonCaller and run it with FME.
When clicking on the small arrow next to Run, you will be able to choose Copy Python Command.
Unfortunately, this solution will not work. I have to ask FME to run ArcPro Toolbox inside ArcPro.
In general, I am struggling to get the list of all layers included in webmap. I was trying to run the script from
but I get an error
2024-04-12 14:23:00| 8.3| 0.0|ERROR |Python Exception <AttributeError>: 'tuple' object has no attribute 'content'2024-04-12 14:23:00| 8.3| 0.0|ERROR |Traceback (most recent call last):2024-04-12 14:23:00| | |ERROR | File "<string>", line 22, in input2024-04-12 14:23:00| | |ERROR |AttributeError: 'tuple' object has no attribute 'content'2024-04-12 14:23:00| 8.3| 0.0|ERROR |Error encountered while calling method `input'2024-04-12 14:23:00| 8.3| 0.0|FATAL |PythonCaller_7 (PythonFactory): PythonFactory failed to process feature
I would appreciate some help as I am running in circle. In general I do not have to use the Python, I am happy to use ArcGISOnlineConnector but I was not able to expose the list of the layers in the webmap.
Hi,
In general, I have a script that allows me to get the list of layers from webmap. However, it does not seem to work as the code contains
gis = (home").
I was trying to use @nielsgerrits script from
but I got an error
2024-04-12 14:23:00| 8.3| 0.0|ERROR |Python Exception <AttributeError>: 'tuple' object has no attribute 'content'2024-04-12 14:23:00| 8.3| 0.0|ERROR |Traceback (most recent call last):2024-04-12 14:23:00| | |ERROR | File "<string>", line 22, in input2024-04-12 14:23:00| | |ERROR |AttributeError: 'tuple' object has no attribute 'content'2024-04-12 14:23:00| 8.3| 0.0|ERROR |Error encountered while calling method `input'2024-04-12 14:23:00| 8.3| 0.0|FATAL |PythonCaller_7 (PythonFactory): PythonFactory failed to process feature
I am happy to use any FME transformer that will give me the list I want
Hi @marta.podsiad looks like you might be hitting an error due to a programming typo. If you are using the PythonCaller code shared in this thread then you might be running into an error where you import arcgis.gis.GIS but forget to actually use it in gis = ... and accidentally define a bare tuple instead of passing arguments to GIS. so a few lines later an error is raised because the code is trying to do gis.content.get(...) when gis is just a tuple.
I used double # to indicate new comments. I’m not particularly an expert, but I hope this helps.
import fme import fmeobjects ## this is where you import GIS from arcgis.gis import GIS from arcgis.mapping import WebMap
# Connect to your ArcGIS Online organization or Portal for ArcGIS ## you should also use GIS in this argument gis = ("https://maps-eu.ramboll.com/portal", "USERNAME", "PASSWORD")
# Get the web map item by its ID web_map_id = "ITEMID"
## gis is currently an empty tuple because of the above not using GIS web_map_item = gis.content.get(web_map_id) web_map = WebMap(web_map_item)
# Create an empty list to store layer names layer_names = ]
# Append each layer name to the list for layer in web_map.layers: layer_names.append(layer.title)
# Create a feature with the list of layer names feature_out = fmeobjects.FMEFeature() feature_out.setAttribute("layer_names", layer_names) self.pyoutput(feature_out)