Hello,
We have added a table in MMPK file with multiple locations and their details.
Now in android application we need to fetch those locations and details.
Can we fetch the table and location data from MMPK file? If yes, how we can do that?
Thank You
In order to fetch the table and location data from the MMPK file, you will first have to create and instance of MobileMapPackage and load it.
Here is a sample which shows how create a map from a mobile map package and displays it.
Once you have the map created from the MobileMapPackage, you can iterate over its operationalLayers
to find the FeatureTable that has all your location data and can even perform a query operation on it to filter data based on a query string.
val featureLayer = mmpk.maps[0].operationalLayers.filterIsInstance<FeatureLayer>().first() // gives the first FeatureLayer in the operationLayers of the map
// then you can get the feature table from the feature layer
val featureTable = featureLayer.featureTable
Alternatively,
You can iterate over the ArcGISMap's tables and find the feature table there.
val mapPackage = MobileMapPackage(filePath)
mapView.map = mapPackage.maps.first()
val featureTable = mapView.map.tables.first()// gives the first table in map's table list
To find out how to query the feature table you can refer to this sample