我有一个带有一些地标的KML脚本,其中有一些内容写在“描述”部分(以HTML风格)。一切正常,但在某些描述部分,我想要包含一个链接/引用,指向KML脚本中另一个地标的描述部分。
当用户点击指向巴黎的地标时,会打开包含描述内容的气球(这已经正常工作)。我想要实现的是,在这个气球中,用户应该能够点击突出显示的单词,例如“让我们搬到马赛”,在这之后,巴黎 - 巴隆应该关闭,而马赛 - 巴隆 - 属于马赛地标的描述部分 - 应该打开。
这可能吗?我在文档中或通过谷歌搜索找不到任何相关内容。 (或者我太傻了,找不到它)。
干杯,艾玛
答案 0 :(得分:1)
您可以使用说明中的特殊链接从一个地标链接到另一个地标,其中一个引用另一个。该机制在KML标准中称为特征锚。
请注意,巴黎地标中的网址为#marseille;balloonFlyto
,其中" id"目标地标的属性是" marseille"点击时要采取的目标行动是" balloonFlyto"。
这是完整的KML,其中一个地标链接到另一个:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>feature anchor</name>
<description>Feature anchor using ; to delimit action.</description>
<Placemark id="paris">
<name>Paris</name>
<description>
<![CDATA[
let's move to <a href="#marseille;balloonFlyto">Marseille</a>
]]>
</description>
<Point>
<coordinates>2.3508,48.8567</coordinates>
</Point>
</Placemark>
<Placemark id="marseille">
<name>Marseille</name>
<description>
<![CDATA[
Welcome to Marseille.
Return to <a href="#paris;balloonFlyto">Paris</a>
]]>
</description>
<Point>
<coordinates>5.37,43.2964</coordinates>
</Point>
</Placemark>
</Document>
</kml>
弹出描述气球中的目标href可以是片段URL(即带有#符号后跟KML标识符的URL)。您还可以使用分号(;)和其中一个限定符将操作附加到URL:
摘录自KML reference。