Contents
Is the ArcPy Python library with hosted feature layer?
Using the arcpy Python library with hosted feature service layers from ArcGIS Online? Is it possible to use the arcpy library with hosted feature service layers from ArcGIS Online? I am aware of the ArcGIS API for Python, but the API lacks many of arcpy’s features.
What is the name of the feature layer in ArcGIS?
A feature service serves a collection of feature layers and tables, with the associated relationships among the entities. It is represented by arcgis.features.FeatureLayerCollection in the ArcGIS Python API.
How to update your hosted feature services with ArcGIS?
One method is well defined using ArcMap; you select the option to overwrite the hosted feature layers when publishing your updates back to ArcGIS online. In 2013 and 2014 we explained how you could update your hosted feature services automatically, at a prescribed time, using Python.
How to add the ArcGIS API to Python?
Investigate your hosted content and be certain of the service definition (.sd) and feature layer names before proceeding. The first step is to install the ArcGIS API for Python; from within ArcGIS Pro, find and add the arcgis package using the Python Package Manager.
How to publish a map service in Python?
You can automate map service publishing in a Python script. To do this, you need to call the following sequence of functions from the arcpy.mapping module and tools from the Server toolbox. Use the arcpy.mapping function CreateMapSDDraft to create a draft service definition (.sddraft).
Is the ArcPy Python library a wrapper on tools?
The point is arcpy is a wrapper on tools, and all * tools were built at a time to work against local datasets (fgdb, shape, etc) and enterprise geodatabase layers, not to work against hosted feature layers. Now I put the ** beside the all comment because from ArcGIS Pro, some tools will accept a feature layer input and modify it.
Can you run ArcPy scripts on ArcGIS Online?
Finally, I would prefer not to download the ArcGIS Online layer, run arcpy scripts on it locally, then re-publish the layer, since this tends to reset symbology, field names, etc. – but if anyone who knows more about ArcGIS Online can help with this strategy, that could solve the problem as well. The arcpy code would be something as simple as: