Error creating an offline geodatabase in Quartz

910
6
Jump to solution
01-04-2017 07:05 AM
Highlighted
New Contributor III

I am getting an error using the sample code (https://developers.arcgis.com/net/latest/wpf/guide/create-an-offline-map.htm) for creating an offline replica geodatabase:

"Job failed. Job error 22 User defined failure. Error while handling generate geodatabase job status. Job error 400 Failed to create replica. Multiple layers are referencing a dataset, which is not supported."

Even if I point the endpoint to a local ArcGIS Server feature service with only 1 layer in it I get the same error. If I create it with the same arguments within a web browser then it creates the replica on the server without issue.

Does anyone know a solution to this?

Thanks

Paul

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Occasional Contributor II

Hey Paul,

I tried this today and experienced the same issue you described. I took a closer look at the underlying REST request and the culprit was the value of the layers parameter, which looked like this: "[0,1,2,0,1]" (notice that layers 0 and 1 are in there twice). The following code adds to the GenerateGeodatabaseParams.LayerOptions, but those layers (and one more) are already defined by default:

generateGdbParams.LayerOptions.Add(new GenerateLayerOption(marineLayerId, dolphinsOnlyWhereClause));
generateGdbParams.LayerOptions.Add(new GenerateLayerOption(birdsLayerId));

So ... you just need to clear the LayerOptions before adding to them:

generateGdbParams.LayerOptions.Clear(); //<--Do this before adding to the layer options

generateGdbParams.LayerOptions.Add(x);

generateGdbParams.LayerOptions.Add(y);

I also found another glitch "downstream" from this that you might hit. When creating the layer from one of the output GDB tables, you need to make sure you load the table first, otherwise you'll get an exception when trying to read properties (such as the Name of the table):

// get the first table
var gdbFeatureTable = gdb.GeodatabaseFeatureTable(0);
await gdbFeatureTable.LoadAsync(); // <--Load it!
// create a FeatureLayer to display the table
var localGdbLayer = new FeatureLayer(gdbFeatureTable);
// name the layer with the table name
localGdbLayer.Name = gdbFeatureTable.TableName; //<--exception here if it's not loaded

Apologies for the frustration, we certainly should have caught this before putting it in the doc. Thanks for pointing it out ... at least we can save the next person some stress! Please let us know if you hit anything else.

Thad

View solution in original post

Reply
0 Kudos
6 Replies
Highlighted
Esri Frequent Contributor
Reply
0 Kudos
Highlighted
New Contributor III

Thanks for the reply Morten.

The problem with the links you supplied is that they are not for not for Quartz and I am using the Esri tutorial code from https://developers.arcgis.com/net/latest/wpf/guide/create-an-offline-map.htm and the Esri ArcGIS online feature service uri and it is still not working.

I can supply the code I am using but it is just what Esri is saying to use!

Reply
0 Kudos
Highlighted
Esri Frequent Contributor

The problem with the links you supplied is that they are not for not for Quartz

That doesn't really matter, since this is a service error, and not a runtime error.

Reply
0 Kudos
Highlighted
New Contributor III

Ok - So the code examples you give for runtime Quartz will not work because the Esri rest endpoints (layers) are invalid for the example you provide in the tutorial. Can you give valid endpoints for your examples in the code tutorial?

I am not trying to be difficult but if I try with my local ArcGIS Server 10.4.1 endpoints with one feature layer then it still does not work. Someone In Esri needs to take responsibility for this.

Morten can you escalate this to someone in ArcGIS Server/ ArcGIS Online?

Thanks

Paul

Reply
0 Kudos
Highlighted
Occasional Contributor II

Hey Paul,

I tried this today and experienced the same issue you described. I took a closer look at the underlying REST request and the culprit was the value of the layers parameter, which looked like this: "[0,1,2,0,1]" (notice that layers 0 and 1 are in there twice). The following code adds to the GenerateGeodatabaseParams.LayerOptions, but those layers (and one more) are already defined by default:

generateGdbParams.LayerOptions.Add(new GenerateLayerOption(marineLayerId, dolphinsOnlyWhereClause));
generateGdbParams.LayerOptions.Add(new GenerateLayerOption(birdsLayerId));

So ... you just need to clear the LayerOptions before adding to them:

generateGdbParams.LayerOptions.Clear(); //<--Do this before adding to the layer options

generateGdbParams.LayerOptions.Add(x);

generateGdbParams.LayerOptions.Add(y);

I also found another glitch "downstream" from this that you might hit. When creating the layer from one of the output GDB tables, you need to make sure you load the table first, otherwise you'll get an exception when trying to read properties (such as the Name of the table):

// get the first table
var gdbFeatureTable = gdb.GeodatabaseFeatureTable(0);
await gdbFeatureTable.LoadAsync(); // <--Load it!
// create a FeatureLayer to display the table
var localGdbLayer = new FeatureLayer(gdbFeatureTable);
// name the layer with the table name
localGdbLayer.Name = gdbFeatureTable.TableName; //<--exception here if it's not loaded

Apologies for the frustration, we certainly should have caught this before putting it in the doc. Thanks for pointing it out ... at least we can save the next person some stress! Please let us know if you hit anything else.

Thad

View solution in original post

Reply
0 Kudos
Highlighted
New Contributor III

Thanks Thad for looking into this. I can now create an offline geodatabase!!!