How do I make a hosted feature layer editable with the ArcGIS API for Python

1806
3
08-01-2017 10:10 AM
GregMcNamee
New Contributor III

I'm writing a script to upload a FGDB to ArcGIS Online, view it in a web map, and edit it. Using the API for Python. I've figured everything out except how to turn on editing (create, update, delete, etc). Anyone have any idea how to do that?

Any help would be appreciated.

Thanks.

Greg McNamee
0 Kudos
3 Replies
AtmaMani
Esri Contributor

To turn on editing, you need to access the published layer as a    FeatureLayerColleciton object in Python and perform an `update_definition()` operation as shown below:

from arcgis.features import FeatureLayerCollection
fortune_fl_item = gis.content.search('title:your_feature_layer', item_type = 'Feature Layer')[0]
flc = FeatureLayerCollection(fortune_fl_item.url, gis)
flc.manager.update_definition({'capabilities':'Create,Delete,Query,Update,Editing,Extract'})

We gave a talk at the UC about this, you can find the notebook here: https://github.com/Esri/arcgis-python-api/blob/master/talks/uc2017/ArcGIS%20Python%20API%20-%20Advan... If you scroll down to the part that talks about 'Editing features' you can find the workflow

GregMcNamee
New Contributor III

Thanks. I had just read it here: Updating feature layer properties | ArcGIS for Developers 

I appreciate the help.

Greg McNamee
0 Kudos
SarthakTewari24
New Contributor

Hi,

When I run the update_definition on my hosted feature layer published using file geodatabase. I get the following error:

 

code - 

flc.manager.update_definition({'capabilities':'Create,Delete,Query,Update,Editing'})

 

SarthakTewari24_0-1640011407323.png

Any ideas on what could be the issue?

 

0 Kudos