1
votes

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)

1

1 Answers

0
votes

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