GeoServer地图在Mapbox中使用
重要的一点是数据要求,EPSG3857
具体代码如下:
map.on('load', function () {
map.addLayer({
id: 'commonBaseLayer',
type: 'raster',
source: {
type: 'raster',
tiles: [
'http://localhost:8080/geoserver/TB/wms?service=WMS&version=1.1.0&request=GetMap&layers=TB:TB&styles=&bbox={bbox-epsg-3857}&width=256&height=256&srs=EPSG:3857&format=image/png&TRANSPARENT=TRUE'
],
// "bounds": [-180, -90, 180, 90],
tileSize: 256
}
});
});