天地图山东的影像更加清晰一些,所以进行了更换
const tileMatrixLabels = []
for (let i = 1; i <= 20; ++i) {
tileMatrixLabels.push(i)
}
Cesium.Ion.defaultAccessToken = "";
const viewer = new Cesium.Viewer('cesiumContainer',{
terrainProvider: Cesium.createWorldTerrain(),
animation: false, //动画控制不显示
timeline: false, //时间线不显示
fullscreenButton: false, //全屏按钮不显示
infoBox: false,
geocoder: false, //右上角 搜索
homeButton: false, //右上角 Home
sceneModePicker: false, //右上角 2D/3D切换
baseLayerPicker: false, //右上角 地形
navigationHelpButton: false, //右上角 Help
});
var tdtyx = new Cesium.WebMapTileServiceImageryProvider({
url: "http://www.sdmap.gov.cn/tileservice/SDRasterPubMap",
layer: "BigdataBg",
style: 'default',
format: 'image/jpeg',
tileMatrixSetID: 'BigdataSdmapBlack',
tileMatrixLabels,
tilingScheme: new Cesium.GeographicTilingScheme(),
})
var tdtzj = new Cesium.WebMapTileServiceImageryProvider({
url: "http://www.sdmap.gov.cn/tileservice/sdrasterpubmapdj",
layer: "BigdataBg",
style: 'default',
format: 'image/png',
tileMatrixSetID: 'BigdataSdmapBlack',
tileMatrixLabels,
tilingScheme: new Cesium.GeographicTilingScheme(),
})
viewer.imageryLayers.addImageryProvider(tdtyx);
viewer.imageryLayers.addImageryProvider(tdtzj);
viewer.clock.currentTime = Cesium.JulianDate.addHours(Cesium.JulianDate.now(new Date()), 8, new Cesium.JulianDate());
viewer.clock.multiplier = 1.0;
viewer._cesiumWidget._creditContainer.style.display = "none";
//定位到文登
viewer.camera.setView({
destination: Cesium.Rectangle.fromDegrees(
120.705683,
36.747004,
122.922175,
37.644009
),
});