Loading vtpk via VectorTileCache reports success but the map is not shown

321
1
Jump to solution
07-25-2023 04:18 AM
padmalcom
Occasional Contributor

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")
}
}
}
0 Kudos
1 Solution

Accepted Solutions
padmalcom
Occasional Contributor

Okay, my fault. I did not download the correct geometry and thus the map was empty at my current viewpoint.

View solution in original post

0 Kudos
1 Reply
padmalcom
Occasional Contributor

Okay, my fault. I did not download the correct geometry and thus the map was empty at my current viewpoint.

0 Kudos