首页 > 解决方案 > Google KML 导入替换图标

问题描述

我有带有自定义图标的地图https://www.google.com/maps/d/u/0/edit?mid=1iwhgwHJgtmYOS6PokVdvTqTgpB51xCAg&usp=sharing 导入 KML 图标后变成这个https://www.gstatic.com/mapspro /images/stock/503-wht-blank_maps.png

有结果 KML

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <name>test map</name>
    <description/>
    <Style id="icon-1594-7CB342-nodesc-normal">
      <IconStyle>
        <color>ff42b37c</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
      </IconStyle>
      <LabelStyle>
        <scale>0</scale>
      </LabelStyle>
      <BalloonStyle>
        <text><![CDATA[<h3>$[name]</h3>]]></text>
      </BalloonStyle>
    </Style>
    <Style id="icon-1594-7CB342-nodesc-highlight">
      <IconStyle>
        <color>ff42b37c</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
      </IconStyle>
      <LabelStyle>
        <scale>1</scale>
      </LabelStyle>
      <BalloonStyle>
        <text><![CDATA[<h3>$[name]</h3>]]></text>
      </BalloonStyle>
    </Style>
    <StyleMap id="icon-1594-7CB342-nodesc">
      <Pair>
        <key>normal</key>
        <styleUrl>#icon-1594-7CB342-nodesc-normal</styleUrl>
      </Pair>
      <Pair>
        <key>highlight</key>
        <styleUrl>#icon-1594-7CB342-nodesc-highlight</styleUrl>
      </Pair>
    </StyleMap>
    <Folder>
      <name>Campings</name>
      <Placemark>
        <name>Ein Yarkam camping</name>
        <styleUrl>#icon-1594-7CB342-nodesc</styleUrl>
        <Point>
          <coordinates>
            35.039418,30.945092,0
          </coordinates>
        </Point>
      </Placemark>
    </Folder>
  </Document>
</kml>

标签: google-mapskml

解决方案


从“我的地图”导出 KML 不支持“我的地图”中提供的所有图标选项。这在导出对话框中说明:

在此处输入图像描述

另一种方法是使用 KMZ 导出(不要选中“导出为 KML...”按钮),这将生成一个 KMZ 文件(压缩的 KML 文件),其中包含捆绑在 zip 中的图标图像。

另一种选择是在 Google 地球或其他一些 KML 编辑器中编辑 KML 并更改图标。如果需要,您可以从 KMZ 中提取图标,将其在线托管在某处,然后将该图标的 URL 放入您的 KML 文件中。


推荐阅读