Skip to content

Commit

Permalink
Setup geodatabase after it's copied into cache
Browse files Browse the repository at this point in the history
  • Loading branch information
01smito01 committed Jan 3, 2025
1 parent 2ccdd6d commit 296ffef
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ class MapViewModel(application: Application) : AndroidViewModel(application) {
// offline vector tiled layer to be used as a basemap
private val fillmoreVectorTileLayer = ArcGISVectorTiledLayer("$provisionPath/FillmoreTopographicMap.vtpk")

// mobile database containing offline feature data
private val geodatabase = Geodatabase("${cacheDir.path}/ContingentValuesBirdNests.geodatabase")

// instance of the contingent feature to be added to the map
private var feature: ArcGISFeature? = null

Expand All @@ -102,6 +99,9 @@ class MapViewModel(application: Application) : AndroidViewModel(application) {
// create a temporary directory for use with the geodatabase file
createGeodatabaseCacheDir()

// create mobile database containing offline feature data
val geodatabase = Geodatabase("${cacheDir.path}/ContingentValuesBirdNests.geodatabase")

viewModelScope.launch {
// retrieve and load the offline mobile geodatabase file from the cache directory
geodatabase.load().getOrElse {
Expand Down Expand Up @@ -163,8 +163,8 @@ class MapViewModel(application: Application) : AndroidViewModel(application) {
}

/**
* Geodatabase creates and uses various temporary files while processing a database,
* which will need to be cleared before looking up the [geodatabase] again.
* [Geodatabase] creates and uses various temporary files while processing a database,
* which will need to be cleared before looking up the geodatabase again.
* A copy of the original geodatabase file is created in the cache folder.
*/
private fun createGeodatabaseCacheDir() {
Expand Down

0 comments on commit 296ffef

Please sign in to comment.