def main(argv): input_gdb = 'Enter .geodatabase location' output_gdb = 'Enter in an existing fgdb location you want data to be exported into' try: opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="]) except getopt.GetoptError: print 'test.py -i <input_gdb> -o <input_gdb>' sys.exit(2) for opt, arg in opts: if opt == '-h': print 'test.py -i <input_gdb> -o <output_gdb>' sys.exit() 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. arcpy.Delete_management(Temp_xml) # 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. arcpy.Delete_management(Temp_xml) if __name__ == "__main__": main(sys.argv[1:])
Russell,
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.
Thanks,
Randy Weaver
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?
Thanks Marianne, the script ended up working like you had mentioned. I did not however have the issue that you are currently having.
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.
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:
\\servername\ArcGISServer\directories\arcgissystem\arcgisuploads\services\servicename\
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.
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+.
thankx
Frank
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.
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?