Error adding features to offline GDB (!input_SR || !output_SR)

1008
4
Jump to solution
07-08-2018 03:52 PM
ChristopherMilack1
New Contributor III

I'm working with an offline geodatabase with version 100.3 of the iOS SDK.  I have an AGSFeatureTable and used create() to get a new feature. I set the geometry on the new feature and then attempt to save.  

let table = self.esriGeodatabase?.geodatabaseFeatureTable(withName: tableName)
let feature = table?.createFeature()
feature.geometry = geometry
table.save(feature, completion)

I get the following error and stack trace (image attached):

Error Domain=com.esri.arcgis.runtime.error Code=2 "Invalid argument" UserInfo={NSLocalizedFailureReason=!input_SR || !output_SR, NSLocalizedDescription=Invalid argument, Additional Message=!input_SR || !output_SR}

Note: Same as the error here: Error updating Feature: Invalid Argument: !input_SR || !output_SR 

I've verified the following: 

  • The AGSFeatureTable spatial reference is set to 102100
  • The spatial reference of the new feature's geometry is 102100
  • The geometry is not nil and was created with an AGSSketchEditor

The error message and stack trace lead me to believe that a reprojection is occurring but I can't understand why, since the table SR matches the geometry SR. Regardless, I can't see why this would fail since the spatial reference is set on both the feature table and the new feature.

Any help on this would be much appreciated.

0 Kudos
1 Solution

Accepted Solutions
GarimaDhakal
New Contributor III

Thank you, Christopher. I am able to reproduce the issue with your data and I have submitted the bug for us to investigate the issue further and fix it in future release of the SDK. 

View solution in original post

4 Replies
GarimaDhakal
New Contributor III

Hi Christopher Milack,

Are you adding a new feature to the feature table using add(_:completion:) method? I am asking because we do not have a method called save(_:completion:) on AGSGeodatabaseFeatureTable or AGSFeatureTable.

Since you are using sketch editor to create a geometry and the geometry's spatial reference is 102100, I assume your basemap is in web mercator spatial reference. Is it so?

The error you are seeing seems to be data specific. Is it possible for you to send me your geodatabase file so I can test with it? You can send the file in my inbox. 

Thanks,

Garima

0 Kudos
ChristopherMilack1
New Contributor III

Garima,

My apologies - I am using the add method you referenced. And my baseman is in web mercator.

I'm not seeing a way to send that geodatabase privately via geonet (maybe Im just missing it). Is there an email address or other means to upload it?

0 Kudos
GarimaDhakal
New Contributor III

Thank you, Christopher. I am able to reproduce the issue with your data and I have submitted the bug for us to investigate the issue further and fix it in future release of the SDK. 

GarimaDhakal
New Contributor III

I would like to provide additional information regarding this issue with a workaround. 

The geodatabase is generated from sync enabled feature service using `generateJob(with:downloadFileURL:)` method on AGSGeodatabaseSyncTask.  The AGSGenerateGeodatabaseParameters has a property called `layerOptions` that takes a list of AGSGenerateLayerOption, which can be created with layerID using the initializer `init(layerID:)`.

The bug is reproducible if the first element of layerOptions parameter contains an instance of AGSGenerateLayerOption created from non-spatial layer's ID. This bug is under investigation to fix in future release of the SDK. In the meantime, the workaround is to create layerOptions such that it contains spatial records followed by non-spatial records.

Thank you, Christopher Milack for bringing this issue to our attention. 

Best,

Garima

0 Kudos