我正试图在地图框中加载光栅,但出现了错误。
binding.mapView.getMapboxMap().loadStyleUri(Style.MAPBOX_STREETS)
{ style ->
style.addSource(
rasterSource("maastokartta-source") {
url("http://52.59.214.0/maanmittauslaitos/avoin/wmts/1.0.0/maastokartta/default/ETRS-TM35FIN/{z}/{x}/{y}.png")
})
// Create a RasterLayer with the source created above and then add the layer to the map
if (style.getLayer("tunnel-street-minor-low") != null) {
style.addLayerBelow(
RasterLayer("maastokartta-layer", "maastokartta-source"),
"tunnel-street-minor-low"
)
} else {
style.addLayer(RasterLayer("maastokartta-layer", "maastokartta-source"))
}
}
错误记录
[maps-core]: {OnlineFileSourc}[General]: The resource http://52.59.214.0/maanmittauslaitos/avoin/wmts/1.0.0/maastokartta/default/ETRS-TM35FIN/{z}/{x}/{y}.png not found
[maps-core]: {droid.lctracker}[Style]: Failed to load source maastokartta-source: HTTP status code 404
[maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: HTTP status code 404, sourceID: maastokartta-source, tileID: null
工作示例URL:
http://52.59.214.0/maanmittauslaitos/avoin/wmts/1.0.0/maastokartta/default/ETRS-TM35FIN/0/0/0.png