Using Feature Service URL in Arcpy

1805
4
03-19-2020 01:00 PM
aam
by
Occasional Contributor

Hi guys whats the best way to process a Feature services url in arcpy?

I have number of feature services (here's and example of one layer: https://services1.arcgis.com/d0ZCwU7eGKVeNiEE/ArcGIS/rest/services/MVT_Trails/FeatureServer/0 )

I am trying to process these layers, clip them to my jurisdiction and then save them in a GDB. However, arcpy does not recognize a feature service and I am getting an error.

Does anyone know what I need to do?

0 Kudos
4 Replies
JoeBorgione
MVP Emeritus

see this post of mine:  

https://community.esri.com/thread/246363-using-arcpy-to-copy-a-portal-feature-service-to-a-fgdb-feat... 

you'll need to venture into the arcpy api....

That should just about do it....
aam
by
Occasional Contributor

would it be easier to use model builder instead. I've never used Arcpy API. 

0 Kudos
JoeBorgione
MVP Emeritus

I'm not a model builder guy; if you follow what Joshua Bixby‌ instructs me to do, you should be fine.  That was my first time into the api myself...

That should just about do it....
ANH
by
New Contributor II

Assuming you want to use the service as an input for geoprocessing tools in arcpy, I would recommend using the MakeFeatureLayer_management() function:

url = r"https://services1.arcgis.com/d0ZCwU7eGKVeNiEE/ArcGIS/rest/services/MVT_Trails/FeatureServer/0"
layer_name = "MVT Trails"
layer = MakeFeatureLayer_management(url, layer_name).getOutput(0)

 

0 Kudos