How to add local Geodatabase feature class grammatically to the Map object created thru: ArcGISRuntimeEnvironment.createObject("Map",{}); ?
Thank you
Here is some code to do this - arcgis-runtime-samples-qt/FeatureLayer_Geodatabase.qml at master · Esri/arcgis-runtime-samples-qt · ...
Essentially you need to:
- Create a Geodatabase object via the path to the local file - Geodatabase QML Type | ArcGIS for Developers
- Iterate through the list of GeodatabaseFeatureTable objects - Geodatabase QML Type | ArcGIS for Developers
- For each feature table, create a Feature Layer by setting the featureTable property - FeatureLayer QML Type | ArcGIS for Developers
- Add the FeatureLayers to the Map's operational layer list model
I am trying to create the Map object from Geodatabase layer:
var geodb = ArcGISRuntimeEnvironment.createObject("Geodatabase", {path: outputGdb});var t1 = geodb.geodatabaseFeatureTablesByTableName["offline_test"];var fc = ArcGISRuntimeEnvironment.createObject("FeatureLayer", {featureTable: t1});var map2 = ArcGISRuntimeEnvironment.createObject("Map",{});map2.operationalLayers.append(fc);mapView.map = map2; Map loads with no data, is this wrong way to load GB data programmatically? Thank you,
Proper way: var geodb = ArcGISRuntimeEnvironment.createObject("Geodatabase", {
path: outputGdb});
geodb.loadStatusChanged.connect(function () {
if (Enums.LoadStatusLoaded === geodb.loadStatus) {
var tables = geodb.geodatabaseFeatureTables;
var t1 = geodb.geodatabaseFeatureTablesByTableName["offline_test"];
var fc = ArcGISRuntimeEnvironment.createObject("FeatureLayer", {featureTable: t1});
var map = ArcGISRuntimeEnvironment.createObject("Map",{});
map.operationalLayers.append(fc);
mapView.map = map;
}
})
Thank you,