<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Load FeatureTables and FeatureLayers from geodatabase in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/load-featuretables-and-featurelayers-from/m-p/1222101#M5859</link>
    <description>&lt;P&gt;For performance reasons, where objects have a strong dependent relationship (e.g. a FeatureLayer is dependent on (or "owns") a FeatureTable), that is limited to a single "owner" at a time.&lt;/P&gt;&lt;P&gt;It looks like you do not need this line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;arSceneView.sceneView.scene.tables.addAll(featureTables)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are taking the feature tables that you have already created feature layers for (i.e. each FeatureTable is already "owned" by a FeatureLayer) and trying to add them to the Scene's tables collection. This will try to set the Scene as the table's owner, but the layer is already the owner.&lt;/P&gt;&lt;P&gt;The scene's tables property is for standalone tables that are not used by a layer (perhaps they're related to features and/or don't have geometry).&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2022 15:49:48 GMT</pubDate>
    <dc:creator>Nicholas-Furness</dc:creator>
    <dc:date>2022-10-14T15:49:48Z</dc:date>
    <item>
      <title>Load FeatureTables and FeatureLayers from geodatabase</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/load-featuretables-and-featurelayers-from/m-p/1221965#M5858</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;BR /&gt;I need to load some FeatureLayers and FeatureTables stored in a Geodatbase saved on the device, to my scene,&lt;BR /&gt;but when I try to add them to my scene I have an Exception that says "Object is already owned", but I have cleared&lt;BR /&gt;the collections before trying add and I don't understand why I have this error.&lt;BR /&gt;My code to load the data is:&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;                            try {
                                var geoDb = Geodatabase(fullPath)
                                geoDb.addDoneLoadingListener {
                                    try {
                                        if(geoDb.loadStatus == LoadStatus.LOADED){

                                            for(geoDbFeatureTable in geoDb.geodatabaseFeatureTables){
                                                val featureLayer = FeatureLayer(geoDbFeatureTable)
                                                //featureTables.add(geoDbFeature)
                                                //val featureLayer = FeatureLayer(geoDbFeature)
                                                featureTables.add(geoDbFeatureTable)

                                                try{
                                                    FeatureLayerUtils().setGraphicLayer(featureLayer, layer)
                                                    featureLayers.add(featureLayer)
                                                }
                                                catch (e: InterruptedException){
                                                    Log.e("LOGERROR", "Error identifying resuts: " + e.message)
                                                }
                                                catch (e : ExecutionException){
                                                    Log.e("LOGERROR", "Error identifying results: " + e.message)
                                                }
                                                // Aggiornamento del Bounding Box
                                                FeatureLayerUtils().updateBoundingBox(featureLayer, layer, arSceneView.originCamera.location)


                                                featureLayer.sceneProperties.altitudeOffset = layer.defaultObjectY.toDouble()
                                                featureLayer.sceneProperties.surfacePlacement = LayerSceneProperties.SurfacePlacement.RELATIVE
                                                featureLayer.isVisible = layer.visible
                                                featureLayersPair[layer] = featureLayer
                                                featureLayers.add(featureLayer)
                                                layerBoundingBoxPair[layer] = FeatureLayerUtils().createBoundingBox(arSceneView.originCamera.location, layer.maxDistanceFromOrigin.toDouble())
                                            }

                                            try {
                                                arSceneView.sceneView.scene.tables.clear()
                                                arSceneView.sceneView.scene.operationalLayers.clear()
                                                arSceneView.sceneView.scene.tables.addAll(featureTables)
                                                arSceneView.sceneView.scene.operationalLayers.addAll(featureLayers)
                                                viewModel.setTables(featureLayers)
                                                val tablesToFilter: Spinner = binding.assets.findViewById(R.id.tablesToFilter)
                                                tablesToFilter.adapter = AssetSpinnerAdapter(applicationContext, featureLayers)

                                                val featureLayer: FeatureLayer = featureLayers[0]
                                                viewModel.setTableFilters(FeatureLayerUtils().getFeatureLayerStringFields(featureLayer))
                                                val fieldFilters: Spinner = binding.assets.findViewById(R.id.fieldFilters)
                                                val editTextSearchAsset: EditText = binding.assets.findViewById(R.id.editTextSearchAsset)
                                                if (viewModel.uiState.value.tableFilters.isEmpty()) {
                                                    fieldFilters.visibility = View.GONE
                                                    editTextSearchAsset.visibility = View.GONE
                                                } else {
                                                    fieldFilters.adapter = AssetFilterSpinnerAdapter(applicationContext, viewModel.uiState.value.tableFilters)
                                                    fieldFilters.visibility = View.VISIBLE
                                                    editTextSearchAsset.visibility = View.VISIBLE
                                                }
                                            }
                                            catch (e : Exception){
                                                Log.d(TAG, "Error: " + e.message)
                                            }
                                        }
                                    }
                                    catch (e : Exception){
                                        Log.d(TAG, "Error")
                                    }
                                }
                                geoDb.loadAsync()
                            }
                            catch (e : Error){
                                Log.d(TAG, "Error")
                            }&lt;/LI-CODE&gt;&lt;P&gt;Thanks yo all for the support!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 10:27:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/load-featuretables-and-featurelayers-from/m-p/1221965#M5858</guid>
      <dc:creator>SimoneVitale</dc:creator>
      <dc:date>2022-10-14T10:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Load FeatureTables and FeatureLayers from geodatabase</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/load-featuretables-and-featurelayers-from/m-p/1222101#M5859</link>
      <description>&lt;P&gt;For performance reasons, where objects have a strong dependent relationship (e.g. a FeatureLayer is dependent on (or "owns") a FeatureTable), that is limited to a single "owner" at a time.&lt;/P&gt;&lt;P&gt;It looks like you do not need this line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;arSceneView.sceneView.scene.tables.addAll(featureTables)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are taking the feature tables that you have already created feature layers for (i.e. each FeatureTable is already "owned" by a FeatureLayer) and trying to add them to the Scene's tables collection. This will try to set the Scene as the table's owner, but the layer is already the owner.&lt;/P&gt;&lt;P&gt;The scene's tables property is for standalone tables that are not used by a layer (perhaps they're related to features and/or don't have geometry).&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 15:49:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/load-featuretables-and-featurelayers-from/m-p/1222101#M5859</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2022-10-14T15:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Load FeatureTables and FeatureLayers from geodatabase</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/load-featuretables-and-featurelayers-from/m-p/1222737#M5861</link>
      <description>&lt;P&gt;Hi Nicholas,&lt;/P&gt;&lt;P&gt;thank you!&lt;/P&gt;&lt;P&gt;I have made some changes in the loading method and now I have this:&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;var geoDb = Geodatabase(fullPath)
geoDb.addDoneLoadingListener {
    try {
        if(geoDb.loadStatus == LoadStatus.LOADED){
            val fLayers = geoDb.geodatabaseFeatureTables.map { featureTable -&amp;gt; FeatureLayer(featureTable) }
            arSceneView.sceneView.scene.operationalLayers.addAll(fLayers)
        }
    }
    catch (e : Exception){
        Log.d(TAG, "Error")
    }
}
geoDb.loadAsync()&lt;/LI-CODE&gt;&lt;P&gt;but on the map I don't see anything.&lt;/P&gt;&lt;P&gt;The geodatabase is generated from a FeatureService that show some polygon on the map and if I load from remote I see al polygons, but loading from GeoDatabase not show anything.&lt;/P&gt;&lt;P&gt;To generate my Geodatabase from the remote service I use this code:&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;val generateGeoBdJob = geoDbSyncTask.generateGeodatabase(generatedParams, geoDBPath)
generateGeoBdJob.addStatusChangedListener{
    if(generateGeoBdJob.status == Job.Status.SUCCEEDED)
    {
        Log.d(TAG, "Local Data successfully created for $serviceName on internal storage")
        //response.add("Local Data successfully created for $serviceName on internal storage")
        val result =  generateGeoBdJob.result
        if(result != null)
        {
            val geoDBPath = result.path
            Log.d("TAG", "Current path of Geo Database: $geoDBPath")
            // TODO: Show a message to the user
        }
    }
    else if(generateGeoBdJob.status == Job.Status.FAILED)
    {
        val message : String = "Local Data for $serviceName not created."
        Log.d(TAG, message)
    }

    // Remove this job from list
    geoDbJobList.remove(generateGeoBdJob)
    // Check if this job is the last in the list and hide the loader
    if(geoDbJobList.isEmpty())
    {
        stopLoading()
    }

}
generateGeoBdJob.start()&lt;/LI-CODE&gt;&lt;DIV&gt;&amp;nbsp;Do you see anything wrong in the generation of the GeoDB?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you for your support.&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Oct 2022 09:34:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/load-featuretables-and-featurelayers-from/m-p/1222737#M5861</guid>
      <dc:creator>simone-vitale-overit</dc:creator>
      <dc:date>2022-10-18T09:34:58Z</dc:date>
    </item>
  </channel>
</rss>

