Displaying data in table format inside a balloon in google earth

4,054 views
Skip to first unread message

Abhinav

unread,
Jun 17, 2008, 4:56:59 PM6/17/08
to KML Developer Support - Third Party Applications
Hi all!!

I am new to KML. I am actually working on project where I have 300
locations and for each location i have 4 possible configuration.I have
some costs related to each configuration of location and based on this
I want to select best configuration. I am calculating these costs in
my backend in access. Right now I am able to display all these costs
in a balloon in GE, but I want them to be displayed in following
manner


Configuration1 Configuration 2
Configuration3
cost A

cost B

I went thru extended data tag in KML reference file but I guess that
allows only two columns:- one for field and other for its value. I am
currently generating .KML using VB code. If some of the seniors can
guide me how to display data in grid format in balloon then I'll be
very thankful. I also tried implementing XML table tag, but it seems
it doesnot work for KML.

amb

unread,
Jun 18, 2008, 5:59:07 AM6/18/08
to KML Developer Support - Third Party Applications
Hi Abhinav:
Below is an example that you can build on...It is based upon the
Balloon Style example from the KML reference:
http://code.google.com/apis/kml/documentation/kmlreference.html#balloonstyle
You could also move the HTML table into the description of the
placemark:
http://code.google.com/apis/kml/documentation/kmlreference.html#description
THANXS
amb

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>BalloonStyle.kml</name>
<open>1</open>
<Style id="exampleBalloonStyle">
<BalloonStyle> <!-- a background color for the balloon -->
<bgColor>ffffffbb</bgColor> <!-- styling of the balloon text --
>
<text>
<![CDATA[
<b><font color="#CC0000" size="+3">$[name]</font></b>
<br/>
<br/>
<font face="Courier">$[description]</font>
<br/>
<br/>
Extra text that will appear in the description balloon
<br/>
<br/>
<TABLE BORDER="1">
<TR>
<TH>&nbsp;</TH>
<TH>Config 1</TH>
<TH>Config 2</TH>
<TH>Config 3</TH>
</TR>
<TR>
<TH>Cost A</TH>
<TD>$1</TD>
<TD>$2</TD>
<TD>$3</TD>
</TR>
<TR>
<TH>Cost B</TH>
<TD>$10</TD>
<TD>$20</TD>
<TD>$30</TD>
</TR>
</TABLE>
<!-- insert the to/from hyperlinks --> $[geDirections] ]]>
</text>
</BalloonStyle>
</Style>
<Placemark>
<name>BalloonStyle</name>
<description>An example of BalloonStyle</description>
<styleUrl>#exampleBalloonStyle</styleUrl>
<Point>
<coordinates>-122.370533,37.823842,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
Reply all
Reply to author
Forward
0 new messages