有谁知道如何使用本地磁盘或网络驱动器上的图像显示自定义KML地标图标。
我试过了,它不起作用:
<?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>
谢谢
<href>
KML中的元素采用URL,而不是Windows文件路径。URL可以是绝对位置或相对位置。
要使其正常工作,建议您首先将KML文件和图片移至同一文件夹,然后按其文件名引用该图片。
<Style id="icon">
<IconStyle>
<Icon>
<href>etnasss.jpg</href>
</Icon>
</IconStyle>
</Style>
来源:https://developers.google.com/kml/documentation/kmlreference#href
接下来,您可以通过图像的绝对位置(例如file:/// C:/etnasss.jpg)来引用该图像,但是Google Earth具有关于在KML文件上下文之外访问文件系统上本地文件的安全策略。您必须允许访问通常不建议的本地文件。
或者,您可以创建KMZ文件(又名ZIP文件),并将图像包含在KMZ存档文件中,然后在KML文件中引用它。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句