AnsweredAssumed Answered

Creating Replicas from Feature Services

Question asked by Caleb1987 on Aug 4, 2015
Latest reply on Aug 4, 2015 by GHarlowe-esristaff

I am developing an application where field workers can upload and download construction phase photos for various work sites. Since many of these people do not want to use the collector app or do any attributing through drop downs, I have a python script as a GP service to take a folder containing their photos, mine the photo EXIF data to get GPS tags and direction that the pic was taken and these are converted to points to be added to the feature service.  This piece works great.

 

I then have another python script as a GP Service that downloads photos the user selects by drawing a rectangle (by using Create Replica).  Because they want the attachments to come over with the points, I figured the easiest option would be to create a replica as that will package up the features and links to attachments as JSON, which can easily be converted to geodatabase feature classes via Python for the user to download as a zip file.  This part works great too, except for the replica process.

 

The problem I am having is that these replicas seem to be a snapshot in time from the first time a replica was created (done with my testing when there were only 6 photos).  According to the help docs, this is expected behavior:

 

By default, a version is created every time someone takes a map offline. However, the ArcGIS Server administrator or feature service owner can configure the feature service so a version is created for each login.

 

For example, if five different field workers take a map offline, five versions are generated. Each version is specific to an individual login, and the version name is based on the login name and the service name (for example, Joe_ValveFS). If Joe takes the map offline multiple times (for example, from more than one device), the same version is used when Joe syncs from each device. Thus one device has access to edits from the other device. However, new offline maps will only be as up-to-date as the last time Joe's version was reconciled. A version will remain as long as the person who took the map offline still has the offline map.

I currently have the feature service sync enabled with creating a new replica per user log in.  Sometimes, we may need to create replicas for offline edits, but NOT for the photo download GP task.  For the purposes of the GP task, we will only need a stand alone copy of the data and I was hoping I could use create replica for that.  Because the JavaScript web app is using the same credentials for every replica creation request, every subsequent version has the same 6 features I obtained from the very first replica while testing.  I have Unregistered all of these, thinking that would break the connection to the cached replica features and I could get new features in the replica, but this did not work either.

 

I have read through a lot of documentation, and it seems the answer is to sync back this replica to the feature service.  I tried to use the syncrhonizeReplica with no "edits" parameter (and unregistering again), and I am still only getting the 6 testing features in each replica I create.  I thought that would destroy the replica and not make any changes to the data, but this didn't work either.  Am I missing something here?

 

I know I can query all the features within the user defined box, then iterate through the OID's to get get attachments and convert all that to a geodatabase with attachments, but I want to see if I can fix my replica issue before trying this.  The other advantage of creating replicas, is that I can specify multiple layers to be added to the replica.

Outcomes