I am trying to upload a File geodatabase, but cannot publish in Portal 10.4.1

2463
3
08-03-2016 02:59 AM
HugoBouckaert
New Contributor II

Hi

I am uploading a File geodatabase using the new arcgis.gis API. Because my Portal is 10.4.1, I should be able to publish the contents of the file geodatabase as feature services. I can upload and publish a shape file, but with similar code, uploading a file geodatabase works, but publishing fails.

Here is the code for the uploading the file geodatabase: 

from arcgis.gis import *

gis = GIS("http://<myportalserver>/arcgis","<username", "<password>")

data = "C:\\temp\\fgdbtest.zip" # File geodatabase zipped up

item_properties = {}
item_properties ["type"] = "fileGeodatabase"  # I need the type definition, otherwise add did not work

fgdbdata = gis.content.add(item_properties, data)# this works, the item is uploaded

fgdbdata.publish() # ERROR:

I get an error that Nonetype has no attribute publish(), so obviously fgdbdata is empty or None. Yet almost the same code does work when uploading a shape file.

Does anyone have an example where a File geodatabase is uploaded as a new item and then the feature classes within published as feature services?

Thanks

Hugo

0 Kudos
3 Replies
JayantaPoddar
MVP Esteemed Contributor

Try using the type as "ZIP" or ".ZIP".

If that doesn't work, try doing the steps manually as mentioned in the following link "Publish the contents of a File Geodatabase".

https://doc.arcgis.com/en/arcgis-online/share-maps/publish-features.htm

Note: You can publish the following data types from an FGDB to a hosted feature layer

     i) Feature Classes (X and Y coordinates; M and Z coordinates will be dropped, if any)

     ii) Tables

     iii) Attachments

     iv) Relationship Classes

0 Kudos
RohitSingh2
Esri Contributor

Set the type as 'File Geodatabase', not 'fileGeodatabase':

item_properties = {}

item_properties['type'] = "File Geodatabase"

When publishing the item, specify a name without periods and spaces, eg:

fgdbdata.publish({'name' : 't3_Name_of_service'})

HugoBouckaert
New Contributor II

Thanks a million, you saved my bacon, it works!

I spent hours on this so your reply is greatly appreciated!

Thanks again

Cheers

Hugo

0 Kudos