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 · GitHub
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,
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.