CesiumJS显示上海东方明珠塔

CesiumJS显示上海东方明珠塔

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <!-- Include the CesiumJS JavaScript and CSS files -->
  <script src="https://cesium.com/downloads/cesiumjs/releases/1.76/Build/Cesium/Cesium.js"></script>
  <link href="https://cesium.com/downloads/cesiumjs/releases/1.76/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
  <style>
    html,body{
        width: 100%;
        height: 100%;
        margin: 0px;
    }
    .header{
        position: absolute;
        top: 50px;
        padding:20px;
        text-align: center;
        font-size: 1.2em;
        background-color: black;
        color: blanchedalmond;
        z-index: 1000;
        border-radius: 20px;
        left: 20px;
    }
</style>
</head>
<body>
  <div class="header">
      上海东方明珠塔3D模型
  </div>
  <div id="cesiumContainer"></div>
  <script>
    // Your access token can be found at: https://cesium.com/ion/tokens.
    Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4MzZiNmNiYS04ZDA1LTQ2NjctYmI4Yy1hY2IyZjgxYTIzMjMiLCJpZCI6Mjc5NjQsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1OTA0NDc2NjZ9.-QBcyRaGNKraFU4WZu9x_1gbsCe7VpOq1cIWzFxXw7Y';
    // Initialize the Cesium Viewer in the HTML element with the `cesiumContainer` ID.
    const viewer = new Cesium.Viewer('cesiumContainer', {
      terrainProvider: Cesium.createWorldTerrain()
    });    
    // Add Cesium OSM Buildings, a global 3D buildings layer.
    const buildingTileset = viewer.scene.primitives.add(Cesium.createOsmBuildings());   

    //const buildingTileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({ url: Cesium.IonResource.fromAssetId(96188), }));

    viewer.animation.container.style.display ='none';//隐藏动画控件
        viewer.timeline.container.style.display ='none';//隐藏时间线控件
        viewer.geocoder.container.style.display ='none';//隐藏地名查找控件
        viewer.cesiumWidget.creditContainer.style.display ='none';//隐藏ceisum标识
    // Fly the camera to San Francisco at the given longitude, latitude, and height.
    viewer.camera.flyTo({
      destination : Cesium.Cartesian3.fromDegrees(121.506379,31.195414, 1500),
      orientation : {
        heading : Cesium.Math.toRadians(0.0),
        pitch : Cesium.Math.toRadians(-25.0),
      }
    });
    
  </script>
 </div>
</body>
</html>