write to .geodatabase file

440
7
12-27-2019 08:52 AM
jaykapalczynski
Frequent Contributor

From my app i can run the below code and it reads my service and puts the points in m my map.  But if I leave the page and come back they are gone as they are temporary

featureTable0.populateFromService(params, true, ["*"]);

I can create a geodatabase file, put that on the mobile device and reference that in my map and that works fine as well...

My question is how do I read the data from a service and write those records to a .geodatabase file that is on the mobile device.  I am doing this outside the sync functionality that comes in examples.

1. Delete all records in the Geodatabase File

2. Query the Feature Service 

3. Write those new records with geometry into my Geodatabase File.

Any ideas?

0 Kudos
7 Replies
ErwinSoekianto
Esri Regular Contributor

I am not sure if what you are trying to do with the file geodatabase (outside the sync functionality) is supported, looping in ArcGIS Runtime SDK for Qt‌ to see if anyone in this group know the answer to this. 

0 Kudos
KeithLarson1
MVP

I haven't tried opening a .geodatabase as a SQLite database, but the file format is the same (I have used a SQLite viewer to view a .geodatabase). You should be able to open the .geodatabase as a SQLite database and execute sql statements. This link should show you how to write to a SQLite database: Qt Quick Local Storage QML Types | Qt Quick 5.14.0. I'm not sure if you will be able to write the geometry into the geodatabase like this, but hopefully you can work with this.

Out of curiosity, why aren't you using the ArcGIS Runtime to add records to the geodatabase? You should be able to use the addFeature() or addFeatures() methods of the FeatureTable class to add features that you query from your Feature Service.

0 Kudos
jaykapalczynski
Frequent Contributor

Does this require additional licencing above a basic licence?....I don't have 40k laying around to simply populate a geodatabase on a mobile device.

0 Kudos
KeithLarson1
MVP

It looks like generating a geodatabase is possible with the Lite license and syncing changes is avaialable with a Basic license. I'm using this as reference: License your app—AppStudio for ArcGIS | Documentation 

0 Kudos
jaykapalczynski
Frequent Contributor

OK it appears that you can (with a lite license) create and download download updates....

I see there is a "Generate Geodatabase" from the samples in AppStudio

I can populate from Service as stated above but this is ONLY temporary and gets removed if you leave the page.

I can use the Generate Geodatabase as mentioned above but creates a new geodatabase every time you hit the button...dosent look like that option works for syncing to the same geodatabase.

Does anyone know of an example out there that looks for a Geodatabase, if not creates one, and then allows the user to store this geodatabase when they leave the page or app.  But also allows then to click a button and update/sync any new features that were created since they last downloaded it.  (NOT creating a new geodatabase each time?)

  • Generate a mobile geodatabase from a sync-enabled feature service
  • Download updates from a sync-enabled feature services to a mobile geodatabase
0 Kudos
jaykapalczynski
Frequent Contributor

I guess my question is am I syncing or simply removing and adding all the points to the geodatabase each time.

I assume this does not bring down the attributes?

Trying to wrap my head around this....any examples?

0 Kudos
jaykapalczynski
Frequent Contributor

If I could find examples on these two areas of interest I think I would be good to go.

This is how I am envisioning this:

1. User clicks a button to download/sync

          a. If there it downloads and syncs new data

          b. if not there it creates a geodatabase file and then downloads and syncs

2. Repeat each time button is clicked.

0 Kudos