如何在kml中引用本地自定义图标? [英] How can I reference local custom icons in a kml?

查看:368
本文介绍了如何在kml中引用本地自定义图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前从未真正尝试过编辑kml文件,因此我不确定要问的是什么,但我会尽力而为.

I have quite literally never tried to edit a kml file before, so I'm not totally sure of what I'm trying to ask, but I'll do my best.

我正在尝试将自定义图标用于我的地标.我试图将图像上传到托管站点并链接到它们,并且还尝试将其放入子文件夹并引用本地地址.这是那些尝试.

I'm trying to use custom icons for my placemarkers. I tried to upload the images to a hosting site and link to them, and I also tried putting them into a subfolder and referencing the local address. Here are those attempts.

  <Style id="1">
    <IconStyle>
      <Icon>
    <href>https://cdn1.imggmi.com/uploads/2019/3/8/63626b5bc964d76ca0d5bdb30fb44afd-full.png</href>
      </Icon>
    </IconStyle>
    </Style>

第二种方法:

  <Style id="1">
    <IconStyle>
      <Icon>
        <href>files/number_1.png</href>
      </Icon>
    </IconStyle>
    </Style>

并且地标引用如下样式:

And the placemarker references the style like this:

        <Placemark>
            <styleUrl>#1</styleUrl>
            <Point>
                <coordinates>-86.78824404543640,36.41901416833124,1005.84</coordinates>
                <altitudeMode>absolute</altitudeMode>
            </Point>
        </Placemark>

无论我做什么,我都无法在GE中显示该图标.我阅读了许多不同的教程,尝试以不同的方式命名文件夹和子文件夹,并尝试使用主文件夹中的kml和子文件夹中的图标来制作kmz.似乎没有任何作用.感觉上我似乎缺少一些基本的或根本上误解了某些方面的信息,但是对于我的一生,我似乎无法弄清楚!

No matter what I do, I can't get the icon to show up in GE. I have read a bunch of different tutorials, tried naming the folder and subfolder differently, and tried making a kmz with the kml in the main folder and the icons in a subfolder. Nothing seems to work. It feels like I'm missing something basic or fundamentally misunderstanding some aspect of this, but for the life of me I can't seem to figure it out!

感谢您的帮助!

推荐答案

此KML在Google Earth中的KMZ/zip文件中对我有用:

This KML works for me in Google Earth in a KMZ/zip file:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
  <Style id="1">
    <IconStyle>
      <Icon>
        <href>files/number_1.png</href>
      </Icon>
    </IconStyle>
    </Style>
    <Placemark>
      <styleUrl>#1</styleUrl>
      <Point>
          <coordinates>-86.78824404543640,36.41901416833124,1005.84</coordinates>
          <altitudeMode>absolute</altitudeMode>
      </Point>
    </Placemark>
  </Document>
</kml>

文件number_1.png在文件"目录中.

The file number_1.png is in the "files" directory.

已显示在Google地图上

在Google地球上:

on Google Earth:

这篇关于如何在kml中引用本地自定义图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆