1

I have the following KML file which is a cube:

</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>

I am trying to make this cube to be drawn 100 meters above the ground, so basically:

enter image description here

I tried adding an 100 but it always display from the bottom.

I am using CESIUM.

1 Answer 1

2

According to Cesium KML Support Page, Cesium hasn't supported some `altitudeMode' options yet.

More importantly, the post in link: How to create 3D boxes within a KML file without ground contact? says "It's not easy. But somehow you can create a cube in the air" in KML. The link in the post is dead. So I suggest to review the example below. (Source: Keyhole Markup Language – Hello Cube)

Briefly, you have to define all surfaces of the cube as in the example.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
 <Document> 
 <name>KML Cube Sample - absolute</name> 
 <Folder>
  <Placemark>
    <name>Top</name>
    <Polygon>
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>        
        <LinearRing>
          <coordinates>
           13.3761524993111,49.7401011145834,2400
           13.3897280864525,49.7401011145834,2400
           13.3897280864525,49.7492856863423,2400
           13.3761524993111,49.7492856863423,2400
           13.3761524993111,49.7401011145834,2400
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>      
    </Polygon>
  </Placemark>
  <Placemark>
    <name>Side A</name>
    <Polygon>
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
           13.3761524993111,49.7401011145834,1400
           13.3897280864525,49.7401011145834,1400
           13.3897280864525,49.7401011145834,2400
           13.3761524993111,49.7401011145834,2400
           13.3761524993111,49.7401011145834,1400           
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>      
    </Polygon>
  </Placemark>
  <Placemark>
    <name>Side B</name>
    <Polygon>
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
           13.3897280864525,49.7401011145834,1400
           13.3897280864525,49.7492856863423,1400
           13.3897280864525,49.7492856863423,2400
           13.3897280864525,49.7401011145834,2400
           13.3897280864525,49.7401011145834,1400           
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>      
    </Polygon>
  </Placemark>
  <Placemark>
    <name>Side C</name>
    <Polygon>
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
           13.3897280864525,49.7492856863423,1400
           13.3761524993111,49.7492856863423,1400
           13.3761524993111,49.7492856863423,2400
           13.3897280864525,49.7492856863423,2400
           13.3897280864525,49.7492856863423,1400
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>      
    </Polygon>
  </Placemark>
  <Placemark>
    <name>Side D</name>
    <Polygon>
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>
        <LinearRing>
          <coordinates>
           13.3761524993111,49.7492856863423,1400
           13.3761524993111,49.7401011145834,1400
           13.3761524993111,49.7401011145834,2400
           13.3761524993111,49.7492856863423,2400
           13.3761524993111,49.7492856863423,1400
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>      
    </Polygon>
  </Placemark>
  <Placemark>
    <name>Bottom</name>
    <Polygon>
      <altitudeMode>absolute</altitudeMode>
      <outerBoundaryIs>        
        <LinearRing>
          <coordinates>
           13.3761524993111,49.7401011145834,1400
           13.3761524993111,49.7492856863423,1400
           13.3897280864525,49.7492856863423,1400
           13.3897280864525,49.7401011145834,1400
           13.3761524993111,49.7401011145834,1400                  
          </coordinates>
        </LinearRing>
      </outerBoundaryIs>      
    </Polygon>
  </Placemark>
 </Folder>
</Document>  
</kml>    
1
  • thank for the reply. I read that page before, they say they support altitudeMode (the normal not gx) with absolute positioning, but yes apparently it's not fully working ? will try your exemple thank you
    – Crocsx
    Jul 17, 2019 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.