【问题标题】:Does Google Maps support KML regions?Google 地图是否支持 KML 区域?
【发布时间】:2013-09-06 02:17:37
【问题描述】:

Google 地图是否像 Google 地球一样支持 KML 区域?

谷歌在这里给出了一个很好的地区描述/教程:

https://developers.google.com/kml/documentation/regions

其中特别提到了 Google 地球,但没有提到 Google 地图。

根据https://developers.google.com/kml/documentation/kmlelementsinmaps Google 地图确实支持 KML 区域,但 https://developers.google.com/kml/documentation/mapsSupport 没有明确提及它们。

Zoom levels in kml files on google maps 在这个问题上也很模棱两可。

我创建了自己的测试 KML 文件(几乎逐字从谷歌窃取):

<?xml version="1.0" encoding="UTF-8"?>  
<kml xmlns="http://www.opengis.net/kml/2.2">  
  <Document>  
    <name>Flat Region</name>  
    <Region>  
      <LatLonAltBox>  
        <north>37.430419921875</north>  
        <south>37.41943359375</south>  
        <east>-122.080078125</east>  
        <west>-122.091064453125</west>  
      </LatLonAltBox>  
      <Lod>  
        <minLodPixels>128</minLodPixels>  
      </Lod>  
    </Region>  
    <GroundOverlay>  
      <name>Mountain View DOQQ</name>  
      <Icon>  
        <href>http://data.bcinfo3.barrycarter.info/graphpaper.gif</href>  
      </Icon>  
      <LatLonBox>  
        <north>37.430419921875</north>  
        <south>37.41943359375</south>  
        <east>-122.080078125</east>  
        <west>-122.091064453125</west>  
      </LatLonBox>  
    </GroundOverlay>  
  </Document>  
</kml>  

你可以在这里看到它:

http://test.bcinfo3.barrycarter.info/bc-image-overlay.pl?url=regiontest.kml&center=37.425,-122.085&zoom=15

当您缩小时,图像仍然可见(尽管作为 白色方块),即使每边只有几个像素。

KML 文件中的“minLodPixels”设置为 128 是否意味着 一旦占用少于 128,它应该停止可见 像素?

如果是这样,这是否证明 Google 地图不支持 KML 区域?

还是我误会了什么?

【问题讨论】:

    标签: kml


    【解决方案1】:

    我无法为您提供完整的解决方案,但我试图避免在大约一年前使用地图中的 Regions 来避免我的点过度拥挤(在 SO 上提出了类似的问题),我的理解是 KmlLayer 不会识别区域,而是只需加载所有内容。我能找到的唯一参考是论坛帖子,例如:http://code.google.com/p/gmaps-api-issues/issues/detail?id=3142

    也就是说,我当时的理解是,这可以通过使用 API 在 javascript 中添加叠加层和区域来实现 - 我只是看了看,找不到一个很好的例子(或任何例子) .

    在我看来,编写自定义叠加层并覆盖绘图函数以在地图缩放时显示/隐藏之前考虑叠加层的大小应该很容易:https://developers.google.com/maps/documentation/javascript/overlays#Drawing

    当我们围绕它实现一些我们需要的功能时,我打算采用的路径 - 但不能解决直接从 KML 实现的问题。有趣的是您链接到表明它受支持的文档。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多