Sync Offline Map Package issue

1853
12
11-08-2017 11:46 AM
JerrySimmons_GISP
New Contributor III

I have an application that references a AGOL web map - I'm able to load the web map in the map view, I'm able to download a map package and reference the downloaded map in the map view, I'm able to add new feature to the downloaded map.  Issue is when I sync using OfflineMapSyncTask the job comes back as successful but I get error on the server side stating "the spatial references do not match".  It appears that the map package that was downloaded and is in a different spatial reference than the feature service in web map service.  

When testing the downloading using GeodatabaseSyncTask I ran into the same issue, however, there was an option to specify the OutSpatialReference in the GenerateGeodatabaseParameters constructor. 

Does this functionality exist, should it be possible to sync a map package to the web map it was downloaded from after adding features?  

FYI - I contacted ESRI support and at this point I was asked to re-project my data to resolve the issue. This is not an option.

OfflineMapSyncTask task = await OfflineMapSyncTask.CreateAsync(_mapView.Map);
OfflineMapSyncParameters para = new OfflineMapSyncParameters()
{
SyncDirection = SyncDirection.Bidirectional,
RollbackOnFailure = true
};

OfflineMapSyncJob job = task.SyncOfflineMap(para);
job.JobChanged += (s, e) =>
{
if (job.Status == Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
{
InvokeOnMainThread(() =>
{
genericAlert("Off Line Map Package", "Synchronization is complete!");
});
}
else if (job.Status == Esri.ArcGISRuntime.Tasks.JobStatus.Failed)
{
InvokeOnMainThread(() =>
{
genericAlert("Off Line Map Package", "Synchronization failed: ");
});
}
else
{
InvokeOnMainThread(() =>
{
string statusMessage = "Sync in progress ...";
});
}
};

0 Kudos
12 Replies
AnttiKajanus1
Occasional Contributor III

I sent you pm with the information.

0 Kudos
AnttiKajanus1
Occasional Contributor III

Can you also make sure that you try the following code after the offline map has been created.

var featureLayer = MyMapView.Map.OperationalLayers.First() as FeatureLayer;
var featureTable = featureLayer.FeatureTable;

// Check if we can syncronize the changes back to the service
// if not, then raise message to say that edits cannot be synced
var capabilties = (featureTable as GeodatabaseFeatureTable).LayerInfo.Capabilities;
if (!capabilties.SupportsCreate || !capabilties.SupportsDelete ||
    !capabilties.SupportsUpdate || !capabilties.SupportsSync)
{
    MessageBox.Show("Features cannot be syncronized back to the service.", "Service doesn't support edits on sync.");
}
0 Kudos
JerrySimmons_GISP
New Contributor III

Got it... the analyst created the services you are referring to and they are not in the projection that my service is in that I'm working with.  It seems you've come across another issue with the capabilities, however, the issue I'm facing has to do with the projection of the feature service compared to the downloaded map package.  The map package converts the data from the feature service's projection when downloaded but when the data is synced, the data is not converted back to the the feature services projection.  When I tested downloading and creating a geodatabase there is an option for an output spatial reference, there is nothing like this for map packages.

gdbParameters.OutSpatialReference = _gdbSyncTask.ServiceInfo.SpatialReference;

Thus due to the projection conflict the server gives the following errors:

Level

Time

Message

Source

SEVERE

Nov 7, 2017, 8:41:30 AM

The spatial references do not match [Setting of values in Destination row failed. Src OID = -1 and and GlobalId: {5136A89A-C6E0-4898-9BF5-BC295A83422C}. Error: Geometry could not be set.] - <database>.DBO.<layer>. Dataset: <database>.DBO.<layer>. Replica: DBO.Ags_Fs_1510061849693.

System/SyncTools.GPServer

SEVERE

Nov 7, 2017, 8:41:30 AM

Failed to transfer inserts. Dataset: <database>.DBO.<layer>. Replica: DBO.Ags_Fs_1510061849693.

System/SyncTools.GPServer

SEVERE

Nov 7, 2017, 8:41:30 AM

Geometry could not be set.

System/SyncTools.GPServer

0 Kudos