Select to view content in your preferred language

Way to publish by addition to AGOL, an alternative to overwrite?

08-18-2020 01:19 PM
New Contributor III


Is it possible to script adding a new layer from an ArcGIS Pro project to a hosted feature service on AGOL, rather than overwriting?

e.g. desired scenario:

*I have an AGOL hosted feature service with a layer called: "2007"

*In ArcGIS Pro I have another layer "2008". I want to add this layer to the above service.

Currently, I am using the arcgis.gis module and the "publish" function to overwrite the whole hosted feature service, however, I am looking for an alternative that is more efficient for large services.


ArcGIS Pro 2.4

Python 3

Windows Server 2016

ArcGIS 10.8


Dead ends I explored:

1) "append"


Reason rejected:

The feature layer collection's append function is for appending from a file geodatabase, or CSV or excel file. I am not seeing a good way to pull from the current Pro project's map itself. Also, it appears to append to an existing feature layer, not add a new layer to the data set.

2) GeoAnalytics' append


Reason rejected:

The GeoAnalytics append is for adding data to an existing layer, not a new layer to an existing dataset.

3) add_to_definition


Reason rejected: Incompatible json.

I used this in conjunction with FeaturesToJson to convert my Pro project's layer 2008 into json, but it doesn't appear to be compatible:


sample code I used:


proj =

map = proj.listMaps()[0]

layer2008 = map.listLayers()[-2]


searchResultsFlc ="title:" + serviceName, item_type="Feature Layer Collection")
flcItem = searchResultsFlc[0]
flcol = arcgis.features.FeatureLayerCollection(flcItem.url, gis)

arcpy.conversion.FeaturesToJSON(layer2008, "layer2008.json")
<Result 'layer2008.json'>

Unable to add feature service definition.
Invalid definition for ESRI.ArcGIS.SDS.Metadata.FeatureServiceDescriptor

4) addDefinition, web api:

Reason rejected: incompatible json

The json generated by FeaturesToJSON is incompatible with the sample json posted in the documentation.


0 Kudos
0 Replies