Hi, I managed to correctly download a VectorTileLayer to a local vtpk file. When I try to load the map from the vtpk file, I get no errors (onSuccess is called on each load() procedure) but the map is not shown. Now, I'm thinking if I'm missing sth essetial. Here is my code.
fun loadMap() {
coroutineScope.launch {
val vtpk = "/StyleItemResources/myVectorTiles.vtpk"
val externalFilesDir = context?.getExternalFilesDir(null)?.path
val vectorTileCache = VectorTileCache(File(externalFilesDir, vtpk).path)
Timber.d("Loading vector tiles from ${vectorTileCache.path}")
vectorTileCache.load().onSuccess {
Timber.d("vectorTileCache loaded.")
val arcGISVectorTiledLayer =
ArcGISVectorTiledLayer(vectorTileCache)
arcGISVectorTiledLayer.load().onSuccess {
Timber.d("vectorTiledLayer loaded successfully.")
mapView.map = ArcGISMap(SpatialReference(MapConstants.EPSG_3857)).apply {
operationalLayers.add(arcGISVectorTiledLayer)
load().onSuccess {
Timber.d("Map loaded")
}
}
}.onFailure { s2 ->
Timber.d("vectorTiledLayer load failed. Status $s2")
}
}.onFailure { s1 ->
Timber.e("vectorTileCache loading failed. Status $s1")
}
}
}
Solved! Go to Solution.
Okay, my fault. I did not download the correct geometry and thus the map was empty at my current viewpoint.
Okay, my fault. I did not download the correct geometry and thus the map was empty at my current viewpoint.