在KML / Google地球中忽略多边形的海拔高度

时间:2017-01-05 21:34:35

标签: kml google-earth

我有一个KML文件,它使用多边形在Google地球中绘制填充区域。在这种情况下,它是一个圆圈。不幸的是,使用Google Earth 7.1.7.2606(这是迄今为止的最新版本)显示文件时会忽略高度。 KML文件本身应符合KML标准2.2。

以下代码代表完整文件(只有xml命名空间(< kml xmlns =" http://www.opengis.net/kml/2.2">)隐藏在下面),当与GE开放时,您应该看到"问题" 500km(= 500000.00m)的高度,即用户应该看到多边形的高度,将被忽略:

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

我还试图&#34;挤出&#34;它,但也没有效果。

我的档案有问题或者GE有错误吗?

1 个答案:

答案 0 :(得分:0)

altitudeMode必须与Polygon而不是MultiGeometry相关联。 Extrude和tessellate也必须是Polygon元素下的子元素。

更正的KML将是:

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

另外,如果你在multiGeometry中只有一个几何体,那么你应该完全抛弃multiGeometry并使用Polygon。