Select to view content in your preferred language

Service Definition or File Geodatabase for publishing a hosted feature layer to AGOL?

4 weeks ago
Labels (2)
New Contributor III

I have a file geodatabase with 100 layers in it. I want each layer to be its own item in AGOL and I'm trying to write a script that will automatically publish them to AGOL. (The hope is I can re-use this later)

I've seen a couple of different methods for publishing layers to AGOL. The one I'm using now uses something like the following code: 

# feature class has been exported to its own GDB
# new gdb has been compressed to a .zip file

item = gis.content.add(path to zipped GDB)
published_item = item.publish(overwrite=True)


This is  resulting in a "Job failed" error and I don't understand why. I've seen that it's possible to use a service definition, but I only want the hosted feature and I don't care about having a map service. Is the service definition method the only way to actually accomplish what I want to do? 


0 Kudos
0 Replies