将光标移到/点击文章中的句子上,可以查看译文。      显示繁体中文内容    显示简体中文内容

KML balloon displaying placemark's folder name?
KML气球名称显示文件夹?

I am writing kml code because it's readily visualisable, and fairly logical.but i want to keep it convertable to my unique, more adequate XML (which's interface, an independent globe i still need to set up), where"placemarks"themselves will be irrelevant, for every element will be included in folders - so i ignore Placemark names, like this :


<Folder>
 <name>Koszeg</name>
 <TimeSpan><begin>-200000000</begin></TimeSpan>

 <Placemark><styleUrl>#pool</styleUrl>
 <Point><altitudeMode>absolute</altitudeMode><coordinates>0,0,0</coordinates></Point>
 <description>jura basalt,flisexfoliatio</description>
 </Placemark>

</Folder>

The only matter is that 'till then, i can only display descriptions in the balloons.there are selectors to display palcemarks's name and description, but could i not"traverse"the code for parent elements (folders)?looking for sthing like this :


<Style id="pool"><BalloonStyle><text>
$[FolderName] or $[parentNode.nodeName]<br/>
$[description]</text></BalloonStyle>
</Style>

+1 more thing i think i could solve though :Linking Placemark Icons and Balloon-text images to local files with the identical (Placemark/Folder's) name.Illustration of intention :


<Style id="genos">
<IconStyle><Icon><href>layer/$[name].png</href></Icon></IconStyle>
<BalloonStyle><text><img src="layer/$[name].png"/></text></BalloonStyle>
</Style>

Thanks gratefully for your consideration!- blip (i'm a rookie, amateur coder, hope i made correct sense )

时间: 作者:

The only entity tags that Google Earth supports are the following :


$[name], $[description], $[address], $[id], $[Snippet], and $[geDirections]

Source : https://developers.google.com/kml/documentation/kmlreference#description

The complete list of entity tags and some undocumented details can be found in the KML Errata.

You can only refer to a child element of current Feature (e.g.name, description, id, etc.). it would be a great idea to access the parent metadata via a special variable (e.g parent), but that is not part of the KML specification.

The only way to display the parent name is add a $[name] tag to the description of the parent folder and/or add that to a balloonStyle associated with it.


<Folder>
 <name>Koszeg</name>
 <description><![CDATA[
 <B>$[name]<B>
 ]]></description>
.. ..
</Folder>

You can, however, link from one Feature (aka Placemark) to another and jump to and/or show its balloon by clicking on the link in another's description balloon.in the KML documentation this is called a feature anchor.an example can be found here.

At the end your the target URL you can append one of the following three strings to the fragment URL for appropriate behavior :

;flyto (default) - fly to the Feature
;balloon - open the Feature's balloon but do not fly to the Feature
;balloonFlyto - open the Feature's balloon and fly to the Feature

原作者:
...