I am using the following
private val wmtsService: WmtsService by lazy { WmtsService("https://view.geoapi-airbusds.com/api/v1/map/imagery.wmts") }
val configuration = RequestConfiguration()
configuration.headers = mapOf(Pair("Authorization","Bearer $Bearer_Token"))
wmtsService.requestConfiguration = configuration
ArcGISRuntimeEnvironment.setLicense(getString(R.string.arcgis_licence_key))
wmtsService.customParameters["service"] = "WMTS"
wmtsService.customParameters["request"] = "GetTile"
wmtsService.customParameters["version"] = "1.0.0"
wmtsService.customParameters["style"] = "default"
wmtsService.customParameters["tilematrixset"] = "3857"
wmtsService.customParameters["Format"] = "image/jpeg"
wmtsService.customParameters["TileMatrix"] = "9"
wmtsService.customParameters["TileRow"] = "296"
wmtsService.customParameters["TileCol"] = "292"
// create a Map
val map = ArcGISMap()
// set the map to be displayed in this view
mapView.map = map
// display wmts data on the map
wmtsService.addDoneLoadingListener {
if (wmtsService.loadStatus == LoadStatus.LOADED) {
// get service info
val wmtsServiceInfo = wmtsService.serviceInfo
// get the first layers id
val layerInfos = wmtsServiceInfo.layerInfos
// create WMTS layer from layer info
val wmtsLayer = WmtsLayer(layerInfos[0])
// set the basemap of the map with WMTS layer
map.basemap = Basemap(wmtsLayer)
}
if (wmtsService.loadStatus == LoadStatus.FAILED_TO_LOAD){
Log.e("ARCGIS", "Load failed: ${wmtsService.loadError.cause}")
}
}
wmtsService.loadAsync()
But I cannot seem to load the satellite imagery from the service. I get a grid of grey squares from the interactive map view.
Not sure what I am doing wrong.
Solved! Go to Solution.
The to set requestConfiguration on the wmtsLayer
wmtsLayer.requestConfiguration = wmtsService.requestConfiguration
if (wmtsService.loadStatus == LoadStatus.LOADED) {
// get service info
val wmtsServiceInfo = wmtsService.serviceInfo
// get the first layers id
val layerInfos = wmtsServiceInfo.layerInfos
// create WMTS layer from layer info
val wmtsLayer = WmtsLayer(layerInfos[0])
// set the basemap of the map with WMTS layer
wmtsLayer.requestConfiguration = wmtsService.requestConfiguration
map.basemap = Basemap(wmtsLayer)
mapView.map = map
}
Thanks @Nicholas-Furness for the assistance