Select to view content in your preferred language

Update Sync and Edit capability? Change feature service Style settings?

463
1
02-06-2019 09:56 AM
by Anonymous User
Not applicable

Is there an option to do this using the ArcGIS API for Python?

0 Kudos
1 Reply
MaximeCampeau
Emerging Contributor

Sure thing, try this out :

#Road Infrastructures
print('Enabling Editing, Sync, Create, Delete, Query, Update and ChangeTracking')
item_to_search = 'XXXXXXXX')
owner = 'XXXXX'
item = gis.content.search(query="title:" + item_to_search + " AND owner: " + owner, item_type="Feature Layer", sort_field='title', sort_order='asc')
flc = FeatureLayerCollection.fromitem(item[0])
print("Road Infrastructures Initial Capabilities ==> {}".format(flc.properties.capabilities))
print("Road Infrastructures Initial Layer capabilities ==> {}".format(flc.layers[0].properties.capabilities))
print('   ')


print('Updating Editing options ...')
flc.manager.update_definition({'capabilities' : 'Query,Sync'})
layer = flc.layers[0]
layer.manager.update_definition({'capabilities' : 'Query,Sync'})


#Check results
# item = gis.content.search(query="title:" + item_to_search + " AND owner: " + owner, item_type="Feature Layer", sort_field='title', sort_order='asc')
# flc = FeatureLayerCollection.fromitem(item[0])
print("Road Infrastructures Updated Capabilities ==> {}".format(flc.properties.capabilities))
print("Road Infrastructures Updated Layer capabilities ==> {}".format(flc.layers[0].properties.capabilities))
print("=================================================================================================================")
0 Kudos