Manual Sync with Database using SQLite database from ArcGIS Collector

05-28-2014 09:45 AM
Occasional Contributor
We are using the ArcGIS Collector on an iPad Air to edit existing features and add new features while disconnected. The application collects the data fine, but we are having issues trying to synchronize with an ArcGIS Server 10.2.2 feature service.

Is it possible to use the file sharing capability through iTunes to copy the the SQLite database off of the iPad and manually synchronize the database with ArcGIS Server and the ArcSDE geodatabase?

Tags (2)
14 Replies
Esri Frequent Contributor
Here is the python out for any white spaces that may be generated when copying and pasting..onnce the KB article is released I will point to that support page.

First copy the .geodatabase file to your computer. You can get to the .geodatabase file under the ArcGIS_Collector folder > offline data > folder with user account name associated with downloaded data > folder with the webmap id > copy the .geodatabase and you paste it onto your computer.

def main(argv):
   input_gdb = 'Enter .geodatabase location'
   output_gdb = 'Enter in an existing fgdb location you want data to be exported into'
      opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
   except getopt.GetoptError:
      print ' -i <input_gdb> -o <input_gdb>'
   for opt, arg in opts:
      if opt == '-h':
         print ' -i <input_gdb> -o <output_gdb>'
      elif opt in ("-i", "--ifile"):
         input_gdb = arg
      elif opt in ("-o", "--ofile"):
         output_gdb = arg
   print 'Input gdb is: "', input_gdb
   print 'Output gdb is: "', output_gdb

   Temp_xml = "temp.xml"

   # Delete the xml workspace document if it exists.

   # Export XML Workspace Document
   arcpy.ExportXMLWorkspaceDocument_management(input_gdb, Temp_xml, "DATA", "BINARY", "METADATA")

   # Import XML Workspace Document. This assumes that the outputfile geodatabase is EMPTY.
   arcpy.ImportXMLWorkspaceDocument_management(output_gdb, Temp_xml, "DATA", "")

   # Delete the xml workspace document if it exists.

if __name__ == "__main__":

0 Kudos
New Contributor III


Can you please elaborate on the python script your wrote in response to this topic from Brian? I have the same issue with an offline geodatabase but cannot seem to get the python script to do anything. There are not any coding or syntax errors that I can see when comparing it to yours listed. Is this run from within Desktop, from within IDLE or just as a stand-alone file.


Randy Weaver

0 Kudos
Occasional Contributor III

Randy: if  you add the modules to the beginning, this will run as a standalone script.  Add this to the top of the script: import sys, getopt, arcpy

Russell: the result of this script is delta tables, not actual data.  I expected to see the actual data.  Is there a recommended workflow for using these tables to get the ArcGIS Server/iPad data to synchronize back to the parent database?

0 Kudos
New Contributor III

Thanks Marianne, the script ended up working like you had mentioned. I did not however have the issue that you are currently having.

0 Kudos
Occasional Contributor II

Is there a way to manually sync offline data collection to a hosted feature class?

My client successfully tested syncing his offline data collection, so he went out and used Collector for a real inspection. But the real inspection would not sync(tried connecting to different network for faster Internet connection), so I ended up getting his SQLite database from his iPad, and appending it to the original SDE geodatabase that was used to publish the hosted feature class and then re-published feature service to AGOL. It was very time-consuming since the data contained GlobalID fields, which are assigned with new ID values when you append/load data.  This broke relationships formed off the GlobalIDs that was originally assigned to it, such as related tables and attachments.

I am wondering if there's a way I can sync replicas using REST API (ArcGIS REST API ) and the SQLite file.

Regular Contributor

Not really - and trying to "sync" the database from the device can be a bit of a pain, especially if there are edits to existing data and you need to figure out what changed and what didn't.

There is a shortcut you can take that might help though.  When you sync, ArcServer saves a copy of the data that the device transmits to a folder like this:


In there you will find a folder containing a sqlite geodatabase with the diff data (adds/deletes/edits) for your feature service.  If you grab these files and convert them to a file geodatabase you can take care of adding/replacing/deleting features in an ArcMap session.

0 Kudos
Occasional Contributor

Hi Russel, does this script work in ArcGIS Desktop 10.1? My field clients will only have that version whereas in house we use 10.2+.



0 Kudos
Esri Frequent Contributor

The main issue with that script is that any edited features will not come through and could cause errors either in the script or the output in the resulting gdb. The script really only works well when new features have been added. I would really recommend if you can use the 10.3 tool that will migrate the data over into a fgdb.

0 Kudos
Occasional Contributor

Thanks Russell thanks for the information. I would prefer to have clients use 10.3 as well. My constraint unfortunately is that my field clients only have access to 10.1 Basic and I'm trying to utilize the script at that version. My field clients don't have internet access in their locations for days sometimes weeks. Without internet the ability to sync from Collector or even email the .geodatabase file to in house staff is limited. So finding an alternative for the field user to get the data into ArcMAP 10.1 would be beneficial. Any other suggestions?

0 Kudos