KML和海拔

时间:2019-07-16 06:49:36

标签: kml cesium

我有以下KML文件,它是一个多维数据集=>

</Placemark>
<Style id="3Dobject">
    <PolyStyle>
        <color>7fff5500</color>
        <outline>1</outline>
        <fill>1</fill>
    </PolyStyle>
</Style>
<Placemark>
    <name>Warehouse01</name>
    <description>Warehouse Center:106.97777777 -6.19758333</description>
    <styleUrl>#3Dobject</styleUrl>
    <Polygon>
        <extrude>1</extrude>
        <tessellate>1</tessellate>
        <altitudeMode>absolute</altitudeMode>
        <outerBoundaryIs>
            <LinearRing>
                <coordinates>
                    106.9772778,-6.19808333,100
                    106.9782778,-6.19808333,100
                    106.9782778,-6.19708333,100
                    106.9772778,-6.19708333,100
                    106.9772778,-6.19808333,100
                </coordinates>
            </LinearRing>
        </outerBoundaryIs>
    </Polygon>
</Placemark>

我试图将这个立方体绘制在离地面100米的地方。 (

所以基本上=>

enter image description here

我尝试添加100,但始终从底部显示。

我正在使用CESIUM。

1 个答案:

答案 0 :(得分:0)

选项1:具有6个多边形的MultiGeometry

通过定义extrude使KML中的几何图形连接到地面。要在地面上创建一个3-D立方体,则必须关闭拉伸并为该立方体的6个面中的每一个代表一个多边形。

示例:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">

<Placemark>
  <name>Altitude PolyCube Example</name>
  <Style>
    <PolyStyle>
        <color>7fffffff</color>
    </PolyStyle>
  </Style>
  <MultiGeometry>
    <Polygon>
      <!-- bottom panel -->
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
     106.9772778,-6.19808333,100
     106.9782778,-6.19808333,100
     106.9782778,-6.19708333,100
     106.9772778,-6.19708333,100
     106.9772778,-6.19808333,100
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>
    </Polygon>

    <Polygon>
      <!-- top panel -->
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
     106.9772778,-6.19808333,200
     106.9782778,-6.19808333,200
     106.9782778,-6.19708333,200
     106.9772778,-6.19708333,200
     106.9772778,-6.19808333,200
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>
    </Polygon>

    <Polygon>
      <!-- left panel -->
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
     106.9772778,-6.19808333,100
     106.9772778,-6.19808333,200
     106.9772778,-6.19708333,200
     106.9772778,-6.19708333,100
     106.9772778,-6.19808333,100
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>
    </Polygon>

    <Polygon>
      <!-- right panel -->
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
    106.9782778,-6.19808333,100
    106.9782778,-6.19808333,200
    106.9782778,-6.19708333,200
    106.9782778,-6.19708333,100
    106.9782778,-6.19808333,100
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>
    </Polygon>

    <Polygon>
      <!-- front panel -->
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
     106.9772778,-6.19808333,100
     106.9782778,-6.19808333,100
     106.9782778,-6.19808333,200
     106.9772778,-6.19808333,200
     106.9772778,-6.19808333,100
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>
    </Polygon>

    <Polygon>
      <!-- back panel -->
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
     106.9772778,-6.19708333,100
     106.9782778,-6.19708333,100
     106.9782778,-6.19708333,200
     106.9772778,-6.19708333,200
     106.9772778,-6.19708333,100
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>
    </Polygon>

  </MultiGeometry>
</Placemark>

</kml>

选项2:KML和COLLADA多维数据集模型

在使用通用的多维数据集模型(可以在3D Warehouse下载)的情况下,KML可以将多维数据集放置在给定的位置,包括地面以上的高度。

选项3:铯

铯具有Box几何形状,因此可以简单地将Box放置在100米的给定高度上。例如,请参见Cesium Sandcastle Box Demo