zoukankan      html  css  js  c++  java
  • 3、cesium中json、geojson、stk,影像切片等数据的加载(离线的);以及位置初始化

    cesium中json、topojson、geojson、stk,影像切片等数据的加载

    一、geojson、topojson,json数据的加载

      不管是哪种json,都可以通过GeoJsonDataSource去加载;方式是一样的。

      例:

    1 var viewer = new Cesium.Viewer('cesiumContainer');
    2 viewer.dataSources.add(Cesium.GeoJsonDataSource.load('../aa/bb.topojson', {
    3   stroke: Cesium.Color.HOTPINK,
    4   fill: Cesium.Color.PINK,
    5   strokeWidth: 3,
    6   markerSymbol: '?'
    7 }));

    二、STK数据的加载

      例:

    1   viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
    2         url:http://.....()此处为本地或者线上的http链接
    3         requestVertexNormals: true,
    4         requestWaterMask: false,
    5         options1
    6     })

    三、影像切片数据的加载

      例:

    1     viewer.imageryLayers.addImageryProvider = new Cesium.GoogleMapsImageryProvider(options2);
    2     var imageryProvider2 = new Cesium.KQGIS3DTileFileImageryProvider(options2);
    3     var imageryLayer2 = new Cesium.ImageryLayer(imageryProvider2, { show: true });
    4     viewer.imageryLayers.add(imageryLayer2);

    四、cesium位置初始化

    cesium位置初始化,就是在你刚加载3d页面的时候,相机所指向的位置(或者其他一些需要初始化的地方。)

    话不多说,直接上案例,有不懂的请加下面的学习群,一起讨论。

    1     viewer.scene.camera.flyTo({
    2         destination: new Cesium.Cartesian3.fromDegrees(118.16029, 30.15988, 29600.209),
    3         orientation: {
    4             heading: Cesium.Math.toRadians(0),
    5             pitch: Cesium.Math.toRadians(-90),
    6             roll: Cesium.Math.toRadians(0)
    7         },
    8         duration: 3.0
    9     })

    其中的flyto是你飞到某个位置的一个方法。

    118.16029, 30.15988, 29600.209这三个数分别是你的经度、纬度还有高程的位置。
    heading: Cesium.Math.toRadians(0),
    pitch: Cesium.Math.toRadians(-90),
    roll: Cesium.Math.toRadians(0)        请看下面的文档解释:

     duration: 3.0这句话的意思是,你飞到这个位置所用的时间是3秒。
     
  • 相关阅读:
    Kubernetes
    Kubernetes
    Kubernetes
    Kubernetes
    Kubernetes
    代价函数——二次代价函数、交叉熵(cross-entropy)、对数似然(log-likelihood cost)(04-1)
    MNIST手写数字分类simple版(03-2)
    tensorflow非线性回归(03-1)
    python三目运算符
    tensorflow版helloworld---拟合线性函数的k和b(02-4)
  • 原文地址:https://www.cnblogs.com/yaosusu/p/11482101.html
Copyright © 2011-2022 走看看