Problems while exporting FGBD from Arc Online consisting of domains/subtypes

Blog Post created by sangl003 on Dec 2, 2015

Problems while downloading data from Arc Online:

1.  Looses domains

2.  Looses Subtypes

3.  No attachment information

4.  Incomplete FGDB download for QA


Need to correct the issue:

1.  To do any last minute updates in the schema

2.  To do QA after collecting the data

3.  To provide a working FGDB to the vendor.




Missing attachments or Domain , subtypes from the FDGB downloaded from Arcgis online.


ArcGIS online Data Download Part 1:

From Feature service > Export to File Geodatabase:


Problems in the FGDB downloaded:

Coded values in the table , do not have domain and subtype in the downloaded GDB:

The file does have the attachments:



ArcGIS online Data Download Part 2:


Connecting to the ArcGIS online publisher  account to download the copy of the feature service.

Sign in to the account and you can use arccatalog to view the hosted feature services

Drag and drop the feature service in ArcMap

Right click on the service and Create a local copy.

It will take couple of minutes to create a local copy. This operation creates a Feature Service local edits folder in ArcGIS folder in the user profiles. This has the data for the feature service.

The path is changed to


Before Changing anything  disconnect the local copy from server


Also copy the FGDB to a new location so that you won't be messing the local copies of the feature service

Now notice that the domains and subtypes are present in the FDGB as you had set before uploading.

Now add a new subtype and domain for Recycling and in domain add a coded value as 101 > Game day Recycling

In subtype field point it to the correct domain.

Now you can add the sign data to arcmap.


Your Domain & subtype issue is resolved.


You also want to make sure  that the coded values are not showing up and you can see the text instead.

Now the problem with this is it does not download the attachments and the attachment table is empty.



Now downloading the FGDB with two different ways solves two different problems but still data is not consistent.


Now to export the data from the other attachment folder (download from arconline) into the attachment folder of local copy.


For this you will need do the following steps:

Create a field in the Sign Data point features class from the local copy.

Calculate filed with the following python query.

'photo' + str(!OBJECTID!) +'.jpg'

so a file name photo1003.jpg will be created.


Create a folder named “Attachment” in the same folder where the FGDB lies.

Here we will extract the attachment files from the attachment table (download from arconline) to the attachment folder we created. The file names will be same as photo1003.jpg

We need to create a python tool with the following

import arcpy

from arcpy import da

import os

inTable = arcpy.GetParameterAsText(0)

fileLocation = arcpy.GetParameterAsText(1)

with da.SearchCursor(inTable, ['DATA','GLOBALID', 'ATTACHMENTID']) as cursor:

    for item in cursor:

        attachment = item[0]

        filenum = "ATT" + str(item[2]) + "_"

        filename = "photo"+ str(item[2]) + ".jpg"

        open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())

        del item

        del filenum

        del filename

        del attachment

Make sure to add the parameters as given below.


Your tool should look like this:



Folder with attachment files:


Now Add attachment tool from Arctoolbox can be used to import these files into the empty attachment table (local copy)


Attachment table is loaded with all corresponding attachment of the point features.



You can view your features with attachments and the FGDB has all the required settings.

Now Publish the service again and use the new feature service in the web map.