cesium加载geoserver发布的wmts服务

首先在geoserver上发布影像图的切片,并在tile layer上选择对应的坐标系及图片格式查看图层效果(多级图层)。

var viewer=new Cesium.Viewer("cesiumContainer",{

    sceneMode : Cesium.SceneMode.SCENE2D,

    timeline:false,

    animation:false,//去除时间线条和Animation widget;

    baseLayerPicker:false

});

var url='http://localhost:8080/geoserver/gwc/service/wmts/rest/nurc:shanxi04/{style}/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png'

var image = new Cesium.WebMapTileServiceImageryProvider({

    url:url,

    // layer:'nurc:shanxi04',

    style : '',

    // format : 'image/png',

    tileMatrixSetID : 'EPSG:3857',

    maximumLevel: 20

});

viewer.imageryLayers.addImageryProvider(image);

当版本过低时,TileMatrix无法直接获取

new Cesium.WebMapTileServiceImageryProvider({

        url:'http://localhost:8080/geoserver/gwc/service/wmts/rest/nurc:shanxi04/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}?format=image/png',

        layer:'nurc:shanxi04',

        style:'raster',

        format:'image/png',

        tileMatrixSetID:'EPSG:3857',

        tileMatrixLabels:['EPSG:3857:0','EPSG:3857:1','EPSG:3857:2','EPSG:3857:3','EPSG:3857:4','EPSG:3857:5','EPSG:3857:6','EPSG:3857:7','EPSG:3857:8','EPSG:3857:9','EPSG:3857:10'],

        maximumLevel: 20

})

(ps:当无法获取geoserver发布的影像图地址时,直接查看wmts服务,直接将请求地址放入浏览器查看,即可查看哪些属性有问题)

你可能感兴趣的:(cesium加载geoserver发布的wmts服务)