12

I need to be able to place a polygon object with a given height into a KML that will be located above the ground. I'm looking to display airspace information into a KML and each airspace has a low altitude and and high altitude value.

The closest thing I have been able to do so far is to create two polygons with different altitudes to show the airspace but I have no way of connecting the polygons to show the middle area.

Thanks for your help

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
James Larkin
  • 123
  • 1
  • 1
  • 4
  • Did you ever find an answer to this question? I'm interested in doing something similar myself and would like to 'float' a polygon in mid air – ist_lion Feb 17 '10 at 13:33

2 Answers2

7

Your have two options, you can create a collada model of the air space, or a series of polygon objects defining each face,

verticly oriented polygons can be defined, be take note of the direction of your (clockwise or counter clockwise) as this will effect the style, viewing a polygon from the bottom makes it slightly darker

for a simple rectancular shape you will need 6 faces

the following kml is a modified version of the pentagon example with one of the verticle faces filled in, the other 4 verticle faces need to be complete, but you'll get the idea.

    <?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
    <name>pm1.kml</name>
    <Style id="poly">
        <LineStyle>
            <color>f0ffed42</color>
        </LineStyle>
        <PolyStyle>
            <color>e8ff9257</color>
        </PolyStyle>
    </Style>



<Placemark>
    <styleUrl>#poly</styleUrl>
        <Polygon>
            <altitudeMode>relativeToGround</altitudeMode>
            <outerBoundaryIs>
                <LinearRing>
                    <coordinates>
-77.05844056290393,38.86996206506943,500 -77.05552622493516,38.868757801256,500 
-77.05315536854791,38.87053267794386,500 -77.05465973756702,38.87291016281703,500 -77.05788457660967,38.87253259892824,500 -77.05844056290393,38.86996206506943,500 </coordinates>
                </LinearRing>
            </outerBoundaryIs>
        </Polygon>
</Placemark>
<Placemark>
    <styleUrl>#poly</styleUrl>
        <Polygon>
            <altitudeMode>relativeToGround</altitudeMode>
            <outerBoundaryIs>
                <LinearRing>
                    <coordinates>
-77.05844056290393,38.86996206506943,400 -77.05552622493516,38.868757801256,400 
-77.05315536854791,38.87053267794386,400 -77.05465973756702,38.87291016281703,400 -77.05788457660967,38.87253259892824,400 -77.05844056290393,38.86996206506943,400 </coordinates>
                </LinearRing>
            </outerBoundaryIs>
        </Polygon>
</Placemark>

<Placemark>
    <styleUrl>#poly</styleUrl>
        <Polygon>
            <altitudeMode>relativeToGround</altitudeMode>
            <outerBoundaryIs>
                <LinearRing>
                    <coordinates>
 -77.05844056290393,38.86996206506943,500 -77.05844056290393,38.86996206506943,400 -77.05552622493516,38.868757801256,400  -77.05552622493516,38.868757801256,500  -77.05844056290393,38.86996206506943,500
</coordinates>
                </LinearRing>
            </outerBoundaryIs>
        </Polygon>
</Placemark>

</Document>
</kml>
Berwyn
  • 191
  • 6
1

It sounds like you are creating 2 2d polygons rather than a 3d one? You could create a regular 3d polygon:

http://code.google.com/apis/kml/documentation/kml_tut.html#polygons

Then check out the altitudemode tag in KML to "float it" above the surface:

http://code.google.com/apis/kml/documentation/altitudemode.html

geographika
  • 6,458
  • 4
  • 38
  • 56
  • Thanks for the answer geographika. You are correct the polygons have a altitude mode but all of them are based from the ground up except absolute which will only float the polygon up but will not give it a depth. – James Larkin Feb 12 '10 at 13:15
  • Did you use the 1 tag in your polygon to "join" the polygon from its altitude to the ground? – geographika Feb 17 '10 at 02:24
  • The extrude tag is only if you want to extend to the it will not work for objects in the air. – James Larkin Feb 17 '10 at 14:01
  • Yes you are right. Seems an oversight in the KML specs. There are examples of the 2d faces to create 3d polygons at http://www.skyfool.de/luftraeume/ – geographika Feb 17 '10 at 16:56