Cesium加载天地图

2021-09-02  本文已影响0人  初见_JS

利用cesium加载在线天地图

function addTDTLayer() {
  const tdt_tk = "02ed99e199228a5d47960a0324894605"; //一天只能请求一万次啊

  let TDTImgProvider = new Cesium.WebMapTileServiceImageryProvider({
    url: "http://t{s}.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=" +
      tdt_tk,
    layer: "天地图影像",
    style: "default",
    format: "image/jpeg",
    subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
    tileMatrixSetID: "GoogleMapsCompatible",
  });

  let TDTZJProvider = new Cesium.WebMapTileServiceImageryProvider({
    url: "http://t{s}.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=" +
      tdt_tk,
    layer: "天地图中文注记",
    style: "default",
    format: "image/jpeg",
    subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
    tileMatrixSetID: "GoogleMapsCompatible",
  });

  viewer.imageryLayers.addImageryProvider(TDTImgProvider);
  viewer.imageryLayers.addImageryProvider(TDTZJProvider);
}
上一篇下一篇

猜你喜欢

热点阅读