I am trying to download a hosted layer from our portal and save to a file geodatabase.

Following Using ArcPy to copy a portal feature service to a fgdb feature class:

I've tried:

from arcgis.gis import GIS
from arcgis.features import FeatureLayer

url_gis = r'https://maps.something.se/arcgis/home/'
url_fl = r'https://maps.something.se/server/rest/services/Hosted/service_asfdasfadsfasafdsafdsafdsafsafas653757237adfagdagd.'

user = "username"
pwd = "password"

#fgdb = # path to file geodatabase
#fc = # name of feature class

gis = GIS(url_gis, user, pwd)
fl = FeatureLayer(url_fl)
fs = fl.query() #No errors until this line

builtins.Exception: A general error occurred: maximum recursion depth exceeded while calling a Python object

Am I on the right track with this or are there some easier way to download the data using ArcPy?

  • 2
    This isn't ArcPy, it's the ArcGIS API for Python. If there isn't a FeatureClassToFeatureClass equivalent, you need to go the old-fashioned route of a nested row writer within a row query.
    – Vince
    Feb 8, 2022 at 13:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.