Sof*_*ory 5 icons kml google-earth
有没有人知道如何使用本地磁盘或网络驱动器中的映像显示自定义KML Placemark图标.
我试过这个并没有用:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Style id="icon">
<IconStyle>
<Icon>
<href>c:\etnasss.jpg</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>Simple placemark</name>
<description>Attached to the ground. Intelligently places itself
at the height of the underlying terrain.</description>
<styleUrl>#icon</styleUrl>
<Point>
<coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
</Point>
</Placemark>
</kml>
Run Code Online (Sandbox Code Playgroud)
谢谢
<href>KML中的元素采用URL而不是Windows文件路径.URL可以是绝对或相对位置.
要使其正常工作,建议您先将KML文件和图像移动到同一文件夹,然后按文件名引用图像.
<Style id="icon">
<IconStyle>
<Icon>
<href>etnasss.jpg</href>
</Icon>
</IconStyle>
</Style>
Run Code Online (Sandbox Code Playgroud)
资料来源:https://developers.google.com/kml/documentation/kmlreference#href
接下来,您可以通过其绝对位置引用图像(例如file:/// C:/etnasss.jpg),但Google地球有关于访问KML文件上下文之外的文件系统上的本地文件的安全策略.您必须允许访问通常不推荐的本地文件.
或者,您可以创建KMZ文件(也称为ZIP文件)并将图像包含在KMZ存档文件中,并在KML文件中引用它.