Altitude of Polygon is ignored in KML / Google Earth

837 views Asked by At

I have a KML-file which uses a polygon to draw a filled area in Google Earth. In this case it is a circle. Unfortunately the altitude is ignored when displaying the file with Google Earth 7.1.7.2606 (which is the latest version to date). The KML-file itself should correspond to KML standard 2.2.

The following code reprents the full file (just the xml namespace (<kml xmlns="http://www.opengis.net/kml/2.2">) is hidden below), and when opening with GE you should see the "problem" that the altitude of 500km (=500000.00m), which is the altitude the user should see the polygon, is ignored:

<?xml version="1.0" encoding="UTF-8"?>

<Document>
    <name>orbits</name>
    <open>1</open>
    <Snippet>orbits</Snippet>
    <Style>
        <ListStyle>
            <ItemIcon><href>http://maps.google.com/mapfiles/kml/shapes/sunny.png</href></ItemIcon>
        </ListStyle>
    </Style>

    <!-- begin: Group 1, Graph 1 -->
    <Folder>
        <name>Group: Orbit 1</name>
        <visibility>1</visibility>
        <open>1</open>
        <Style>
            <ListStyle>
                <ItemIcon><href>http://maps.google.com/mapfiles/kml/shapes/arrow-reverse.png</href></ItemIcon>
            </ListStyle>
        </Style>

        <!-- begin: TrimLinesAndPatches -->
        <Folder>
            <name>TrimLinesAndPatches</name>
            <open>0</open>
            <Style>
                <ListStyle>
                    <ItemIcon><href>http://maps.google.com/mapfiles/kml/shapes/target.png</href></ItemIcon>
                </ListStyle>
            </Style>

            <Folder>
                <name>Relative Patches</name>
                <Style id="check-hide-children">
                    <ListStyle>
                        <listItemType>checkHideChildren</listItemType>
                    </ListStyle>
                </Style>
                <styleUrl>#check-hide-children</styleUrl>
                <open>0</open>
                <Style>
                    <ListStyle>
                        <ItemIcon><href>http://maps.google.com/mapfiles/kml/shapes/target.png</href></ItemIcon>
                    </ListStyle>
                </Style>
                <Placemark id="polygon">
                    <name>Relative Patches</name>
                    <TimeSpan><begin>2017-04-12T13:16:44.123Z</begin><end>2017-04-12T13:21:44.123Z</end></TimeSpan>
                    <visibility>1</visibility>
                    <Style>
                        <LineStyle>
                            <color>64FFCCFF</color>
                            <width>0</width>
                        </LineStyle>
                        <PolyStyle>
                            <color>64FFCCFF</color>
                        </PolyStyle>
                    </Style>
                    <MultiGeometry>
                        <extrude>0</extrude>
                        <altitudeMode>absolute</altitudeMode>
                        <tessellate>1</tessellate>
                        <Polygon>
                            <outerBoundaryIs>
                                <LinearRing>
                                    <coordinates>
                                        -12.1159516,-26.3651097,500000.00
                                        -13.0844128,-26.4374313,500000.00
                                        -14.0272910,-26.6524670,500000.00
                                        -14.9194371,-27.0044676,500000.00
                                        -15.7365727,-27.4839749,500000.00
                                        -16.4557337,-28.0780054,500000.00
                                        -17.0557319,-28.7703022,500000.00
                                        -17.5176459,-29.5416541,500000.00
                                        -17.8253587,-30.3702824,500000.00
                                        -17.9661527,-31.2323009,500000.00
                                        -17.9313683,-32.1022573,500000.00
                                        -17.7171071,-32.9537663,500000.00
                                        -17.3249379,-33.7602445,500000.00
                                        -16.7625260,-34.4957477,500000.00
                                        -16.0440739,-35.1359009,500000.00
                                        -15.1904382,-35.6588849,500000.00
                                        -14.2287935,-36.0464258,500000.00
                                        -13.1917549,-36.2847064,500000.00
                                        -12.1159516,-36.3651097,500000.00
                                        -11.0401483,-36.2847064,500000.00
                                        -10.0031097,-36.0464258,500000.00
                                         -9.0414649,-35.6588849,500000.00 
                                         -8.1878292,-35.1359009,500000.00 
                                         -7.4693772,-34.4957477,500000.00 
                                         -6.9069653,-33.7602445,500000.00 
                                         -6.5147960,-32.9537663,500000.00 
                                         -6.3005348,-32.1022573,500000.00 
                                         -6.2657504,-31.2323009,500000.00 
                                         -6.4065445,-30.3702824,500000.00 
                                         -6.7142572,-29.5416541,500000.00 
                                         -7.1761713,-28.7703022,500000.00 
                                         -7.7761695,-28.0780054,500000.00 
                                         -8.4953305,-27.4839749,500000.00 
                                         -9.3124660,-27.0044676,500000.00 
                                        -10.2046122,-26.6524670,500000.00
                                        -11.1474904,-26.4374313,500000.00
                                        -12.1159516,-26.3651097,500000.00 
                                    </coordinates>
                                </LinearRing>
                            </outerBoundaryIs>
                        </Polygon>
                    </MultiGeometry>
                </Placemark>
            </Folder>
        </Folder>
        <!-- end: TrimLinesAndPatches -->
    </Folder>
</Document>

I tried also to "extrude" it, but also there no effect.

Is there something wrong with my file or is there a bug in GE?

1

There are 1 answers

1
CodeMonkey On BEST ANSWER

The altitudeMode must be associated with the Polygon not the MultiGeometry. Extrude and tessellate must also be child elements under the Polygon element.

The corrected KML would be this:

<MultiGeometry>
    <Polygon>
        <extrude>0</extrude>
        <tessellate>1</tessellate>
        <altitudeMode>absolute</altitudeMode> ***
        <outerBoundaryIs>
            <LinearRing>...</LinearRing>
         </outerBoundaryIs>
    </Polygon>
</MultiGeometry>

Also, if you only have a single geometry in the multiGeometry then you should discard the multiGeometry entirely and just use the Polygon.