• 学习【Cesium】第七篇,Cesium地图加载3D建筑物并设置属性(学不会揍我)


    Cesium地图加载3D建筑物

    话不多说,看(图文步骤请查看上一篇)步骤 ↓ ↓ ↓

    第一步: 登陆【cesium icon】 网站: Cesium ion

    第二步: Cesium OSM Buildings 、New York City 3D Buildings添加至My Assets中

    第三步: 建筑3DTiles数据加载至地图

      a. 加载 Cesium OSM Buildings ,设置建筑颜色,定位至上海(东方明珠塔)

    1. // Cesium地图 --加载建筑体并设置不同的颜色
    2. loadBuilding() {
    3. const tileset = this.viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
    4. url: Cesium.IonResource.fromAssetId(96188)
    5. }))
    6. this.viewer.camera.lookAt(Cesium.Cartesian3.fromDegrees(121.49272854520109, 31.24444484775727, 600.5782714174909),
    7. new Cesium.HeadingPitchRange(Cesium.Math.toRadians(6.2831853071795845), Cesium.Math.toRadians(-0.13274323360597196), 5000))
    8. tileset.style = new Cesium.Cesium3DTileStyle({
    9. color: 'color("#565a57",0.8)',
    10. show: true
    11. })
    12. },

      b. 加载 New York City 3D Buildings,设置建筑颜色规则,定位至纽约(罗斯福岛)

      这边在添加图层资产的时候,我们可以注意到,右边的介绍:

     说的是每个3D Tileset 

    • BIN— NYC DoB(建筑部)ID
    • DOITT_ID— NYC DoITT 信息 ID
    • Longitude— 经度。
    • Latitude— 纬度。
    • Height— 建筑物的地面高度,以米为单位。
    • TerrainHeight— 相对于椭球体到建筑物底部的标高。
    • Year— 这栋建筑的建造年份。
    • Majority_Ownership_Type— 这栋建筑中最常见的业主类型(也分很多类,什么个体、合作等等)。

     //  Cesium地图 --加载建筑体并设置不同的颜色

    1. // Cesium地图 --加载建筑体并设置不同的颜色
    2. loadBuilding2() {
    3. const tileset = this.viewer.scene.primitives.add(
    4. new Cesium.Cesium3DTileset({
    5. url: Cesium.IonResource.fromAssetId(75343)
    6. })
    7. )
    8. this.viewer.camera.lookAt(
    9. Cesium.Cartesian3.fromDegrees(-73.95715181691992, 40.754468669343076, 1847.383194184224),
    10. new Cesium.HeadingPitchRange(Cesium.Math.toRadians(0.5212177975607402),
    11. Cesium.Math.toRadians(-0.10745795023302507), 10000))
    12. // 条件,颜色
    13. tileset.style = new Cesium.Cesium3DTileStyle({
    14. color: {
    15. conditions: [
    16. ['${Height} >= 100', 'color("purple", 0.5)'],
    17. ['${Height} >= 50', 'color("red")'],
    18. ['true', 'color("blue")']
    19. ]
    20. },
    21. show: '${Height} >= 0',
    22. meta: {
    23. description: '"Building id ${id} has height ${Height}."'
    24. }
    25. })
    26. },

     那么下一章,学习空间数据点、线、面、标签的加载,go go

  • 相关阅读:
    数据结构之顺序表习题讲解
    语言模型和词向量的发展史及其原理
    MM32F0140 UART1中断接收和UART1中断发送
    moke、动态图片资源打包显示
    【前端精进之路】JS篇:第4期 作用域
    汽车类、TPS7B8225QDGNRQ1、TPS7B8233EPWPRQ1、TPS7B8601QKVURQ1 40V、低压降 (LDO) 线性稳压器
    Chapter9.3:线性系统的状态空间分析与综合(上)
    (自学)黑客————网络安全技术
    python使用技巧(三十):python保存本地npy与C++调用npy
    基于STM32的烟雾浓度检测报警仿真设计(仿真+程序+讲解视频)
  • 原文地址:https://blog.csdn.net/New_Wang/article/details/126280039