0

全部!

我有一个如下所示的 kml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <name>KML file with polygon for bird species range</name>
    <description>Source various books and websites</description>
    <Style id="rangecolour">
      <LineStyle><color>660000FF</color><width>1</width></LineStyle>
      <PolyStyle><color>660000FF</color></PolyStyle>
    </Style>
    <Style id="linecolour">
      <LineStyle><color>660000FF</color><width>3</width></LineStyle>
    </Style>
    <Placemark><name>distribution/range</name>
      <description></description>
      <styleUrl>#rangecolour</styleUrl>
      <Polygon>
        <tessellate>1</tessellate>
        <altitudeMode>clampToGround</altitudeMode>
        <outerBoundaryIs>
          <LinearRing>
            <coordinates>
              -180.0,180.0,0.0 
              -180.0,-180.0,0.0 
              180.0,-180.0,0.0 
              180.0,180.0,0.0 
              -180.0,180.0,0.0 
            </coordinates>
          </LinearRing>
        </outerBoundaryIs>
        <innerBoundaryIs>
          <LinearRing>
            <coordinates>
              153.056374,-27.500658,0.0 
              153.056374,-27.524105,0.0 
              153.093109,-27.524105,0.0 
              153.093109,-27.500658,0.0 
              153.056374,-27.500658,0.0 
            </coordinates>
          </LinearRing>
        </innerBoundaryIs>
      </Polygon>
    </Placemark>
  </Document>
</kml>

我的意图是在整个世界内做一个“洞”,以便在边界外的所有世界上得到阴影(这只是一个例子),但是,由于某种我不知道的原因,在谷歌地球中工作正常,但在谷歌地图(API v3,至少......是我与“google.maps.KmlLayer(url.kml)”一起使用的那个......)不是。

有谁知道为什么?

先感谢您!

4

1 回答 1

0

外边界是:

        <coordinates>
          -180.0,180.0,0.0 
          -180.0,-180.0,0.0 
          180.0,-180.0,0.0 
          180.0,180.0,0.0 
          -180.0,180.0,0.0
        </coordinates>

这是一个非常窄的正方形(介于 -180 和 +180 之间)

下面显示的 KML 将其用于多边形(带有小洞的整个世界):

<Placemark><name>distribution/range</name>
  <description></description>
  <styleUrl>#rangecolour</styleUrl>
  <Polygon>
    <tessellate>1</tessellate>
    <altitudeMode>clampToGround</altitudeMode>
    <outerBoundaryIs>
      <LinearRing>
        <coordinates>
          180,85 
          90,85 
          0,85 
          -90,85 
          -180,85 
          -180,0 
          -180,-85 
          -90,-85 
          0,-85 
          90,-85 
          180,-85 
          180,0 
          180,85 
        </coordinates>
      </LinearRing>
    </outerBoundaryIs>
    <innerBoundaryIs>
      <LinearRing>
        <coordinates>
          153.056374,-27.500658,0.0 
          153.093109,-27.500658,0.0 
          153.093109,-27.524105,0.0 
          153.056374,-27.524105,0.0 
          153.056374,-27.500658,0.0 
        </coordinates>
      </LinearRing>
    </innerBoundaryIs>
  </Polygon>
</Placemark>

适用于我geoxml3,不适用于KmlLayer

另一个例子

我不知道为什么,Google Maps KML 解析器KmlLayer几乎总是以这种方式被破坏。

相关问题:kml 边界外的阴影区域

于 2013-05-14T05:47:16.137 回答