其他分享
首页 > 其他分享> > Cesium加载WMS和WMTS和TMS

Cesium加载WMS和WMTS和TMS

作者:互联网

一、加载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
            });

 

标签:layer,format,WMS,image,var,WMTS,Cesium,hnny
来源: https://www.cnblogs.com/dog2016/p/15897799.html