Last active
April 26, 2019 20:54
-
-
Save nommuna2/fc11929f27e74dfbf1c123674f3bf94f to your computer and use it in GitHub Desktop.
(ArcGIS API for Python) Sample of adding an item to AGOL,publishing, overwriting, and updating
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Adding an item to AGOL and publishing it | |
csv = r'path to csv' | |
csvItem = gis.content.add({}, csv) | |
csvFeatureLayer = csvItem.publish() | |
#Overwriting a service | |
#Search for the FeatureService by name | |
MyFeatureService = gis.content.search(query='title:SampleTest AND owner:owner') | |
#Get the id related to the Feature Service | |
FeatureServiceID = layerID[0].id | |
#Call overwrite on the feature layer | |
myFeatureLayercollection = FeatureLayerCollection.fromitem(MyFeatureService) | |
myFeatureLayercollection.manager.overwrite(r'path tp csv') | |
#You can also update the csv item by using the update method | |
MyCSV = gis.content.search(query='title:Sample AND owner:owner') #Get the csvItem | |
#Grab the item from the array | |
item = MyCSV[0] | |
item.update({},r'path to csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you Muna!