<?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">
<Document>
<Style id="Line1">
<LineStyle>
<color>ffff0000</color>
<width>4</width>
</LineStyle>
</Style>
<Style id="Line2">
<LineStyle>
<color>ff00ff00</color>
<width>4</width>
</LineStyle>
</Style>
<Style id="Poly1">
<PolyStyle>
<color>ff0000ff</color>
</PolyStyle>
</Style>
<Style id="Poly2">
<PolyStyle>
<color>ffffffff</color>
</PolyStyle>
</Style>
<Placemark>
<name>Line 1</name>
<styleUrl>#Line1</styleUrl>
<LineString>
<coordinates>
-112.265654928602,36.09447672602546,2357
-112.2660384528238,36.09342608838671,2357
-112.2668139013453,36.09251058776881,2357
-112.2677826834445,36.09189827357996,2357
-112.2688557510952,36.0913137941187,2357
-112.2694810717219,36.0903677207521,2357
-112.2695268555611,36.08932171487285,2357
-112.2690144567276,36.08850916060472,2357
-112.2681528815339,36.08753813597956,2357
-112.2670588176031,36.08682685262568,2357
-112.2657374587321,36.08646312301303,2357
</coordinates>
<gx:drawOrder>2</gx:drawOrder>
</LineString>
</Placemark>
<Placemark>
<name>Polygon 1</name>
<styleUrl>#Poly1</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-112.265654928602,36.09447672602546,2357
-112.2660384528238,36.09342608838671,2357
-112.2668139013453,36.09251058776881,2357
-112.2677826834445,36.09189827357996,2357
-112.2688557510952,36.0913137941187,2357
-112.2694810717219,36.0903677207521,2357
-112.2695268555611,36.08932171487285,2357
-112.2690144567276,36.08850916060472,2357
-112.2681528815339,36.08753813597956,2357
-112.2670588176031,36.08682685262568,2357
-112.2657374587321,36.08646312301303,2357
</coordinates>
</LinearRing>
</outerBoundaryIs>
<gx:drawOrder>4</gx:drawOrder>
</Polygon>
</Placemark>
<Placemark>
<name>Line 2</name>
<styleUrl>#Line2</styleUrl>
<LineString>
<coordinates>
-112.265654928602,36.09447672602546,2357
-112.2660384528238,36.09342608838671,2357
-112.2668139013453,36.09251058776881,2357
-112.2677826834445,36.09189827357996,2357
-112.2688557510952,36.0913137941187,2357
-112.2694810717219,36.0903677207521,2357
-112.2695268555611,36.08932171487285,2357
-112.2690144567276,36.08850916060472,2357
-112.2681528815339,36.08753813597956,2357
-112.2670588176031,36.08682685262568,2357
-112.2657374587321,36.08646312301303,2357
</coordinates>
<gx:drawOrder>4</gx:drawOrder>
</LineString>
</Placemark>
<Placemark>
<name>Polygon 2</name>
<styleUrl>#Poly2</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-112.265654928602,36.09447672602546,2357
-112.2660384528238,36.09342608838671,2357
-112.2668139013453,36.09251058776881,2357
-112.2677826834445,36.09189827357996,2357
-112.2688557510952,36.0913137941187,2357
-112.2694810717219,36.0903677207521,2357
-112.2695268555611,36.08932171487285,2357
-112.2690144567276,36.08850916060472,2357
-112.2681528815339,36.08753813597956,2357
-112.2670588176031,36.08682685262568,2357
-112.2657374587321,36.08646312301303,2357
</coordinates>
</LinearRing>
</outerBoundaryIs>
<gx:drawOrder>8</gx:drawOrder>
</Polygon>
</Placemark>
</Document>
</kml>
所以你可以在上面KML我試圖使用GX看到:DRAWORDER元素的行字符串&多邊形分類到繪圖層。但是,如果您在kml interactive sampler甚至Google地球(免費桌面版)中加載該數據,幾何圖元只能按照「類似圖元」的順序排序。也就是說,線串僅針對其他線串進行排序,並且多邊形僅針對其他多邊形排序。谷歌KML GX:DRAWORDER
在這種情況下,您可以看到「第1行」和「第2行」的繪製順序爲<「Polygon 2」&因此我期望「多邊形2」能夠繪製所有內容的頂部。但事實並非如此。最後,我不得不使用高度值來實現我想要的z順序,但這是一個令人不滿意的解決方案,因爲大多數人使用等軸測投影來查看kml幾何。高度值導致我的幾何體傾斜。
我想知道的是:
這是GX的預期行爲:DRAWORDER?元素周圍的文檔是稀疏的&它甚至說它只適用於線串,但根據xsd是應該適用於所有幾何圖元(它看起來好像......至少對於多邊形以及無論如何...)
有沒有辦法讓gx:drawOrder適用於所有 幾何圖元?
在此先感謝!
注[文檔】(https://developers.google.com/kml/documentation/kmlreference#gxdraworder)只提到GX:DRAWORDER與行字符串不多邊形也未提及DRAWORDER跨越不同的幾何形狀(線的行爲戒指和多邊形)。您會希望drawOrder在所有基元上工作相同,但是看起來像GE按類型先分組繪製特徵:首先是疊加,然後是多邊形,後面是直線和點數據,其中drarOrder僅適用於組內。 – JasonM1 2014-12-13 03:34:49