Piotr Gaszewski
Piotr Gaszewski

Reputation: 343

ArcGis Offline map layer changes synchronization

In my WPF application I’m trying to use off-line map functionality. Right now my feature service is configured for data sync and I’m able to create data replica on server and download local copy of geodatabase.

gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(_featureServiceUri);

Envelope extent = new Envelope(xmin, ymin, xmax, ymax, new SpatialReference(wkidStart));

GenerateGeodatabaseParameters generateParams = await _gdbSyncTask.CreateDefaultGenerateGeodatabaseParametersAsync(extent);


_generateGdbJob = _gdbSyncTask.GenerateGeodatabase(generateParams, _gdbPath);
_generateGdbJob.JobChanged += GenerateGdbJobChanged;
_generateGdbJob.ProgressChanged += ((object sender, EventArgs e) =>
{
    UpdateProgressBar();
});
_generateGdbJob.Start();

After initial synchronization, I’m able to successfully work with map in off-line mode. This includes operations like adding new geometries or editing existing polygons inside local DB.

However, when I’m trying to synchronize changes back to server – I’m getting no results.

To perform data synchronization with local database – I’m using the following code:

SyncGeodatabaseParameters parameters = new SyncGeodatabaseParameters()

{

GeodatabaseSyncDirection = SyncDirection.Bidirectional,

RollbackOnFailure = false              

};



Geodatabase gdb = await Geodatabase.OpenAsync(this.GetGdbPath());

foreach (GeodatabaseFeatureTable table in gdb.GeodatabaseFeatureTables)

{

long id = table.ServiceLayerId;
SyncLayerOption option = new SyncLayerOption(id);
option.SyncDirection = SyncDirection.Bidirectional;
parameters.LayerOptions.Add(option);   
}


_gdbSyncTask = await GeodatabaseSyncTask.CreateAsync(_featureServiceUri);

SyncGeodatabaseJob job = _gdbSyncTask.SyncGeodatabase(parameters, gdb);  
job.JobChanged += SyncJob_JobChanged;
job.ProgressChanged += SyncJob_ProgressChanged;
job.Start();

Everything goes well. The synchronization ends with status “Succeeded”. The messages logged by the SyncGeodatabaseJob are like on the screen below: enter image description here

However – when I open edited feature layer from server inside map web client I cannot found any of my local changes. In the serve database I can also see that no new records were created during synchronization.

Interesting think is that when I open “Replica” data inside web I can see the following information:

Replica Server Gen: 2 Creation Date: 2018/02/07 10:49:54 UTC Last Sync Date: 2018/02/07 10:49:54 UTC

The “Last Sync Data” is equal to replica “Creation date” However, in the replica log in ArcMap I can see the following information:

enter image description here

Can anyone can tell me how should I interpret above described situation? Am I missing some steps in my code? Or maybe some configuration feature is missing on the server? It looks like data modifications are successfully pushed back to replica on server but after that replica is not synchronized with server database (should it work automatically?).

I’m a “fresh” person regarding ArcGis development so any help will be appreciated

Upvotes: 0

Views: 375

Answers (2)

Piotr Gaszewski
Piotr Gaszewski

Reputation: 343

Thanks for all the answers. It occurred that there is versioning enabled on the server database and the offline, versioned changes was not reconciled to the server. After running reconcile/post script (http://desktop.arcgis.com/en/arcmap/10.3/manage-data/geodatabases/automate-reconcile-post-after-sync.htm) off-line changes started to be visibile to other system users.

Upvotes: 2

Antti Kajanus
Antti Kajanus

Reputation: 71

The code looks ok on fast look so I would assume that there is something going on in the setup.

What do you get back from the sync operation after the sync has completed? Note that you can just use await syncJob.GetResultsAsync to start the job and wait the results.

How is the Feature Service set up on the server? Please refer https://enterprise.arcgis.com/en/server/latest/publish-services/linux/prepare-data-for-offline-use.htm for the different ways to set these things.

Upvotes: 0

Related Questions