<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>天地图</title> <script src="https://cesiumjs.org/releases/1.74/Build/Cesium/Cesium.js"></script> <script src="http://api.tianditu.gov.cn/cdn/plugins/cesium/cesiumTdt.js" ></script> <link rel="stylesheet" href="https://cesiumjs.org/releases/1.74/Build/Cesium/Widgets/widgets.css"/> <style type="text/css"> html, body, #tiandituContainer { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; } </style> </head> <body> <div id="tiandituContainer"> </div> <script> var cesiumAsset='cesiumAsset'; var tiandituTk='tiandituTk'; var subdomains=['0','1','2','3','4','5','6','7']; Cesium.Ion.defaultAccessToken = cesiumAsset; var viewer = new Cesium.Viewer('tiandituContainer',{ animation:false, homeButton:true, geocoder:true, baseLayerPicker:false, timeline:false, fullscreenButton:true, infoBox:true, sceneModePicker:true, navigationInstructionsInitiallyVisible:false, navigationHelpButton:false, selectionIndicator:false, imageryProvider: 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="+tiandituTk, subdomains: subdomains, layer: "tdtImgLayer", style: "default", format: "image/jpeg", tileMatrixSetID: "GoogleMapsCompatible", show: true }) }); viewer._cesiumWidget._creditContainer.style.display = "none"; viewer.imageryLayers.addImageryProvider(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="+tiandituTk, subdomains: subdomains, layer: "tdtCiaLayer", style: "default", format: "image/jpeg", tileMatrixSetID: "GoogleMapsCompatible", show: true })); viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(112.92, 28.20, 5000), orientation: { heading : Cesium.Math.toRadians(348.4202942851978), pitch : Cesium.Math.toRadians(-89.74026687972041), roll : Cesium.Math.toRadians(0) }, complete:function callback() { } }); </script> </body> </html>
|