content of a ballon from database

6 views
Skip to first unread message

Einstein46

unread,
Nov 27, 2009, 8:52:54 PM11/27/09
to KML Developer Support - Google Earth Plug-in
Hello,

I have a search function implementet in my Homepage. There you can
search for special locations which are defined in a database. That
already works but I want to create balloons whose content comes out of
the database as well. Is that possible and if so, how?
The problem is, that the number of placemarks changes depending on the
search results.

Thanks for your help
Stein

jmatthews

unread,
Nov 30, 2009, 9:21:50 PM11/30/09
to KML Developer Support - Google Earth Plug-in
I recall seeing an example or 2, showing how to include javascript in
balloon descriptions, so I think you might be able to call a js
function from your descriptions, sending a parameter to the function
and evaluating it to return the description you want. Look for the
samples that include js in balloon descriptions. I think they are in
the kml reference guide, but not sure of that.

Kyle

unread,
Dec 18, 2009, 12:59:03 PM12/18/09
to KML Developer Support - Google Earth Plug-in
The easiest solution would be to build the balloon data into the KML
you're already loading to define the placemarks. If you're building
the placemarks manually in javascript, you'll probably want to look
into generating the KML on the server and using fetchKML to grab it.
With that you can control whatever you want in the balloons.

Alternatively, you could use eventHandling to detect when the user
clicks on a placemark, then use javascript to send an AJAX request to
the server for the needed information and create the balloon from
there. This would be less bandwidth intensive if you have tons and
tons of data, but the first method will be easier, less error prone,
and snappier to respond to the user's clicks.
Reply all
Reply to author
Forward
0 new messages