【发布时间】:2020-10-13 15:01:35
【问题描述】:
我正在尝试从 geoserver 2.18 添加 wmts 层。我的代码:
window.mymap.addSource(
"mvt-test-source", {
"type": "vector",
"tiles": [
"http://localhost:8080/geoserver/gwc/service/wmts?SERVICE=WMTS&&VERSION=1.0.0&REQUEST=GetTile&layer=mapbox:roads4326&TILEMATRIX=EPSG:4326:{z}&TILEMATRIXSET=EPSG:4326&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}"
],
"minZoom": 0,
"maxZoom": 14
});
window.mymap.addLayer(
{
'id': 'my_mvt_layer',
'type': 'line',
'source': 'mvt-test-source',
'source-layer': 'mapbox:roads4326',
"visibility": "visible",
'paint': {
'line-color': 'Red',
'line-width': 7
}
}
);
浏览器没有错误,但是图层没有出现在地图上。 可能是什么原因? 当我尝试使用 wms 服务时 - 一切正常。 wms格式的下一段代码:
window.mymap.addSource("wms-test-source", {
"type": 'raster',
"tiles": [
"http://localhost:8080/geoserver/wms?bbox={bbox-epsg-3857}&format=image/png&service=WMS&&version=1.1.1&request=GetMap&srs=EPSG:900913&transparent=true&width=256&height=256&layers=mapbox:roads4326"
],
'tileSize': 256
});
window.mymap.addLayer(
{
"id": 'wms-test-layer',
"type": 'raster',
"source": 'wms-test-source',
"paint": {
}
}
);
【问题讨论】: