cesium(超图版)之多源数据加载

2021-07-12  本文已影响0人  LBHN

1、地形数据

 this.viewer.terrainProvider = new Cesium.CesiumTerrainProvider({

    url: url,

   });

2、影像数据

 const layer = this.viewer.imageryLayers.addImageryProvider(

    new Cesium.SuperMapImageryProvider({

     url: url,

    })

   );

   this.viewer.zoomTo(layer);

3、矢量切片数据,模型数据,BIM数据,倾斜摄影

这些数据,一般会在生产后,经过处理,成为s3m或者3dtiles的格式。然后实现在三维球体上的加载。


image-20210705152008706.png

1)S3M三维缓存数据

 const scene = this.viewer.scene;

   const promise = scene.open(

    url

   );

   promise.then(function (layers) {

    this.viewer.zoomTo(layers);

   });

   console.log(promise);
 const scene = this.viewer.scene;

   const promise = scene.addS3MTilesLayerByScp(

   url

   );

   promise.then((layer) => {

    this.viewer.zoomTo(layer);

   });

   console.log(promise);

2)3dtile

 const tileset1 = new Cesium.Cesium3DTileset({

    url: "./bangonglou/tileset.json",

   });

   tileset1.readyPromise

    .then((tileset) => {

     this.viewer.scene.primitives.add(tileset);

     this.viewer.zoomTo(tileset);

    })

    .otherwise(function (error) {

     console.log(error);

    });

4、天地图(wmts)

1、加载方式

image-20210707141829590.png

2、服务密匙:需要在天地图官网申请

3、服务选择:


image-20210707150124950.png

4、wmts服务参数
请参考:

https://blog.csdn.net/supermapsupport/article/details/76806670
5、代码

 const params = {

    name: "地势阶梯图",

    url: url,

    layer: "ter",

    style: "default",

    format: "tiles",

    tileMatrixSetID: "c",

    tileMatrixLabels: [

     "1",

     "2",

     "3",

     "4",

     "5",

     "6",

     "7",

     "8",

     "9",

     "10",

     "11",

     "12",

     "13",

     "14",

    ],

    tilingScheme: new Cesium.GeographicTilingScheme(),

    // tilingScheme: new Cesium.WebMercatorTilingScheme(),

   };

   const provider = new Cesium.WebMapTileServiceImageryProvider({

    name: params.name,

    url: params.url,

    layer: params.layer,

    style: params.style,

    format: params.format,

    tileMatrixSetID: params.tileMatrixSetID,

    tileMatrixLabels: params.tileMatrixLabels,

    tilingScheme: params.tilingScheme,

   });

   this.viewer.imageryLayers.addImageryProvider(provider);
上一篇下一篇

猜你喜欢

热点阅读