Decouple an offline geodatabase from the online version

444
2
09-01-2017 03:50 AM
MarcWouters
New Contributor III

We want to work in our application with a read/write enabled mobile geodatabase.

Generating one with ArcMap (File - Share as - ArcGIS Runtime Content) produces a read-only .geodatabase.

So, we have published our geodatabase on ArcGIS online, and downloaded a copy (using GeodatabaseSyncTask) to have a copy which can be edited (add, delete features), but our main purpose is to change feature attributes. 

We do not need or want to synchronize the local geodatabase again with the online version.

All the changes we make to the local .geodatabse add copies of the modified features, with changed gdb_from_date/gdb_to_date fields.

How can I prevent this, or consolidate the changes, so the number of features in each table remains the same ?

Tags (2)
0 Kudos
2 Replies
LukeSmallwood
Esri Contributor

Hi Marc, could you post an example of the code you are using to edit the features in your geodatabase?

You might find this sample (arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/EditData/EditAndSyncFeatures at master · Esr... ) a useful reference for editing data in the local geodatabase (although you could ignore the sync code).

This example make a call to updateFeature (FeatureTable Class | ArcGIS for Developers ) in order to change the position of a feature in the geodatabse. The approach should still be the same for your use-case of changing attributes rather than updating positions - but let me know if that is not working for you.

Thanks,

Luke

0 Kudos
MarcWouters
New Contributor III

Hi Luke,

Sorry for the delay in replying - I enjoyed two weeks holiday.

My code does more or less the same as in your example, using updateFeature(). Here is some part of the code :

while (featureQueryResult->iterator().hasNext()) {
  Feature* feature = featureQueryResult->iterator().next();
  bool showLine;
  getVisible(showLine);   // our proprietary code
  feature->attributes()->replaceAttribute("ShowLine", showLine);

  feature->featureTable()->updateFeature(feature);
}

Could it have something to do with versions, or syncing ? 

The geodatabase method hasLocalEdits() returns True after calling updateFeature(). 

How can I inform the geodatabase that all editing is finished, and it's "state" should be clean again ?

0 Kudos