一、加载WMS
let baseUrl = 'http://127。0.0.1:9001/geoserver/hnny/wms'; var provider = new Cesium.WebMapServiceImageryProvider({ url: baseUrl, enablePickFeatures:true, rectangle: Cesium.Rectangle.fromDegrees(115.9595781, 33.70809, 116.648063, 34.298223), layers: 'hnny:Growth_2019', parameters: { TRANSPARENT: true, format: 'image/png', version:'1.3.0', service:'WMS' } });
二、加载WMTS
var wmtsImageryProvider = new Cesium.WebMapTileServiceImageryProvider({ url: 'http://127.0.0.1:9001/geoserver/gwc/service/wmts/rest/hnny:Growth_2020_05/{style}/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png', layer: 'hnny:Growth_2020_05', style: 'raster', format: 'image/png', tileMatrixSetID: 'EPSG:900913', rectangle: Cesium.Rectangle.fromDegrees(73, 21, 140, 50) }); var layer = viewer.imageryLayers.addImageryProvider(wmtsImageryProvider); viewer.flyTo(layer, { duration: 2 });