How to overwrite existing Feature Layer (hosted) with python script

255
0
06-10-2022 02:44 AM
Labels (1)
LukaszKowalski2013
New Contributor

Hi,

Within my organization I have "Feature Layer (hosted)" - I exported it from point feature class in ArcGIS Pro. This layer has about 250 points. I want to update them, add new points, remove others. I have some web maps appended to it and web apps, so I need to overwrite it (or update if it is better option).

I am wondering, how can I do it with python code? What is the workflow with this kind of updates? Why I cannot edit the Feature Layer (hosted) at all in ArcGIS Pro? Can you help me with sample code for this?

 

PS. I tried this article: https://developers.arcgis.com/python/samples/overwriting-feature-layers/ (here is csv instead of feature class as input), and I got 'success' response after this code for my feature layer:

from arcgis.features import FeatureLayerCollection
cities_flayer_collection = FeatureLayerCollection.fromitem(cities_item)
#call the overwrite() method which can be accessed using the manager property
cities_flayer_collection.manager.overwrite(os.path.join('data', 'updating_gis_content',
                               'updated_capitals_csv', 'capitals_1.csv'))

but the layer is not overwritten anyway...

Tags (2)
0 Kudos
0 Replies