谷歌地图中多边形之间的KML垂直线

时间:2016-06-29 11:52:06

标签: javascript google-maps google-maps-api-3 kml

我正在向Google地图添加KML图层。使用Grads(版本2.1.a3)生成KML文件,然后将其上载到我们的Web服务器。 The layer appears on Google Maps, but vertical lines appear on the image。这些线似乎将内部多边形连接到外部多边形。

我原本以为这是一个Grads问题,其中程序在渲染带孔的多边形时遇到问题,但是,我在Google Earth上检查了同一层,并且这些线不存在。对我而言,这意味着问题在于在Google地图中解释KML文件的方式或我自己的编码错误。

KML图层通过以下方式加载到Google地图中:

var kmlUrl = 'http://www.urltokml.com/kmlfile.kml?'+Math.random();
var kmlOptions = {
    suppressInfoWindows: false,
    preserveViewport: false,
    map: map
};
var kmlLayer = new google.maps.KmlLayer(kmlUrl,kmlOptions);

KML文件包含许多不同的多边形,因此下面显示了一个示例。

有谁知道会导致这些线条出现的原因? Google地球可以处理的KML数据中是否有某些功能,但谷歌地图不能?

非常感谢你的帮助。

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
 <Document id="Created by GrADS-2.1.a3">
<Style id="56">
  <LineStyle>
    <color>ffc83c48</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffc83c48</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="49">
  <LineStyle>
    <color>ffd26414</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffd26414</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="47">
  <LineStyle>
    <color>fff08228</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>fff08228</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="45">
  <LineStyle>
    <color>fff5a550</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>fff5a550</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="43">
  <LineStyle>
    <color>fffad296</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>fffad296</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="41">
  <LineStyle>
    <color>ffffffe1</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffffffe1</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="1">
  <LineStyle>
    <color>ffffffff</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffffffff</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="32">
  <LineStyle>
    <color>ffbeffc8</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffbeffc8</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="33">
  <LineStyle>
    <color>ffaafab4</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffaafab4</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="34">
  <LineStyle>
    <color>ff8cf596</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff8cf596</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="35">
  <LineStyle>
    <color>ff73f578</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff73f578</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="37">
  <LineStyle>
    <color>ff3cd237</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff3cd237</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="21">
  <LineStyle>
    <color>ffaafaff</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffaafaff</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="22">
  <LineStyle>
    <color>ff78e8ff</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff78e8ff</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="23">
  <LineStyle>
    <color>ff3cc0ff</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff3cc0ff</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="24">
  <LineStyle>
    <color>ff00a0ff</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff00a0ff</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="25">
  <LineStyle>
    <color>ff0060ff</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff0060ff</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="26">
  <LineStyle>
    <color>ff0032ff</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff0032ff</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="27">
  <LineStyle>
    <color>ff0014e1</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff0014e1</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="28">
  <LineStyle>
    <color>ff0000c0</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff0000c0</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="29">
  <LineStyle>
    <color>ff0000a5</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ff0000a5</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="55">
  <LineStyle>
    <color>ffdc6070</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffdc6070</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="56">
  <LineStyle>
    <color>ffc83c48</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffc83c48</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Style id="57">
  <LineStyle>
    <color>ffb4283c</color>
    <width>0</width>
  </LineStyle>
  <PolyStyle>
    <color>ffb4283c</color>
    <fill>1</fill>
  </PolyStyle>
</Style>
<Placemark>
  <styleUrl>#33</styleUrl>
  <name>3 to 5</name>
  <Polygon>
    <altitudeMode>clampToGround</altitudeMode>
    <tessellate>1</tessellate>
    <outerBoundaryIs>
      <LinearRing>
        <coordinates>
          6.30084,60.0071,0 6.32486,60.0179,0 6.35121,60.0071,0 6.32486,59.9889,0 6.30084,60.0071,0 
        </coordinates>
      </LinearRing>
    </outerBoundaryIs>
  </Polygon>
</Placemark>
<Placemark>
  <styleUrl>#33</styleUrl>
  <name>3 to 5</name>
  <Polygon>
    <altitudeMode>clampToGround</altitudeMode>
    <tessellate>1</tessellate>
    <outerBoundaryIs>
      <LinearRing>
        <coordinates>
          6.93315,60.0612,0 6.91946,60.095,0 6.90916,60.1152,0 6.88215,60.1693,0 6.91946,60.1737,0 6.97351,60.1738,0 
          6.98845,60.1693,0 7.02756,60.1586,0 7.07997,60.1152,0 7.07345,60.0612,0 7.02756,60.0377,0 6.97351,60.0314,0 
          6.93315,60.0612,0 
        </coordinates>
      </LinearRing>
    </outerBoundaryIs>
  </Polygon>
</Placemark>
<Placemark>
  <styleUrl>#33</styleUrl>
  <name>3 to 5</name>
  <Polygon>
    <altitudeMode>clampToGround</altitudeMode>
    <tessellate>1</tessellate>
    <outerBoundaryIs>
      <LinearRing>
        <coordinates>
          7.27598,60.6017,0 7.29783,60.6188,0 7.31795,60.6017,0 7.29783,60.5971,0 7.27598,60.6017,0 
        </coordinates>
      </LinearRing>
    </outerBoundaryIs>
  </Polygon>
</Placemark>
and so on...

0 个答案:

没有答案