Balloon Not Located in Right Spot On Line

5 views
Skip to first unread message

shannon9585

unread,
Dec 16, 2009, 2:04:13 PM12/16/09
to KML Developer Support - Advanced Support for KML
I'm aware that this has been discussed before (here:
http://groups.google.com/group/kml-support-getting-started/browse_thread/thread/7af872099e46a472/dddbe035bccfb44b?lnk=gst&q=linestring+balloon#dddbe035bccfb44b
and in some other posts) but I'm confused about the answer.

When you double-click on a line feature from the Places menu, GE zooms
in to the feature and opens its info balloon. In my KML code below, I
use multigeometry to create a line and specify a point along the line
where I want the label to display. In GE, if I click the line, the
balloon and label appear where I want them to (from the point). But,
if I double-click the feature name from the Places menu, the info
balloon that opens up is NOT located on the line nor the point. It's
about 450 meters north of the line. It appears that the balloon may
be positioned midway between the line's start and end points.

Is this how GE places the balloon - halfway between start and end
points? Shouldn't the balloon be located where my point is? If I use
multigeometry for a polygon feature, the balloon is located at the
point specified in multigeometry. Why is it different for lines?

I'd really like the balloon to pop up where it should - on the point
(or even anywhere on the line would be nice!). Does anyone know if
it's possible to do this?

It's not very useful to click on a place in the Places menu and be
taken somewhere near the feature but not quite to it. This gets worse
for larger, or more complex lines, and sometimes the balloon is
located very far from the actual line. Help!
Here's my KML code:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://
www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>DEC Trails</name>
<open>1</open>
<StyleMap id="STYLEMAP">
<Pair><key>normal</key><styleUrl>#STYLE_NORM</styleUrl></Pair>
<Pair><key>highlight</key><styleUrl>#STYLE_HI</styleUrl></Pair>
</StyleMap>
<Style id="STYLE_NORM">
<IconStyle><scale>0</scale></IconStyle>
<LabelStyle><color>ffffff00</color><scale>0</scale></LabelStyle>
<LineStyle><color>ff00ff00</color><width>3</width></LineStyle>
<BalloonStyle><text><![CDATA[<table><tr><td>$[Trails/KMLName]</td></
tr><tr><td>Allowed Trail Uses:</td></tr><tr><td>$[Trails/FOOT]</td></
tr></table>]]></text></BalloonStyle>
</Style>
<Style id="STYLE_HI">
<IconStyle><scale>0</scale></IconStyle>
<LabelStyle><color>ffffff00</color></LabelStyle>
<LineStyle><color>ffffff00</color><width>7</width></LineStyle>
<BalloonStyle><text><![CDATA[<table><tr><td>$[Trails/KMLName]</td></
tr><tr><td>Allowed Trail Uses:</td></tr><tr><td>$[Trails/FOOT]</td></
tr></table>]]></text></BalloonStyle>
</Style>
<Schema name="Trails" id="Trails_schema">
<SimpleField type="xsd:string" name="FOOT"><displayName>FOOT</
displayName></SimpleField>
<SimpleField type="xsd:string" name="KMLName"><displayName>KMLName</
displayName></SimpleField>
</Schema>
<Folder>
<name>All Trails</name>
<open>1</open>
<Placemark>
<name>7TH LAKE TRAIL</name>
<styleUrl>#STYLEMAP</styleUrl>
<ExtendedData>
<SchemaData schemaUrl="#Trails_schema">
<SimpleData name="FOOT">Hiking</SimpleData>
<SimpleData name="KMLName">7TH LAKE TRAIL</SimpleData>
</SchemaData>
</ExtendedData>
<MultiGeometry>
<Point>
<coordinates>-74.7347702333,43.750645133,0</coordinates>
</Point>
<LineString>
<tessellate>1</tessellate>
<coordinates>
-74.7260914856284,43.7614038615309,0
-74.7251718258255,43.7608028994058,0
-74.7247148838418,43.7598698997618,0
-74.7243882542021,43.7592253275864,0
-74.7252837157463,43.7579849435129,0
-74.7261777477417,43.7569606466857,0
-74.7269392261607,43.7560575731308,0
-74.7280984123399,43.7546737429684,0
-74.72826717662829,43.7538367850612,0
-74.729129528191,43.7525017491489,0 -74.7302857721162,43.7517436498,0
-74.73236246789431,43.7513883801002,0
-74.7341431139391,43.7509153273815,0
-74.7354630128273,43.7503466488304,0
-74.7377720507082,43.7495641303388,0
-74.7399983559492,43.7488759095366,0
-74.74115143757059,43.7488065000984,0
-74.7420099372555,43.7482817118853,0
-74.7430662644221,43.7476898255555,0
-74.7442192112743,43.7476429000817,0
-74.745040198217,43.7482659962808,0
-74.7459932578556,43.748772350683,0
-74.7467830305563,43.7488911417181,0
-74.7475064720292,43.7491808670355,0
-74.74849409916921,43.7493225983757,0 </coordinates>
</LineString>
</MultiGeometry>
</Placemark>
</Folder>
</Document>
</kml>

Jason M

unread,
Dec 19, 2009, 8:33:33 AM12/19/09
to KML Developer Support - Advanced Support for KML
It's because the Point is not visible and only the Line is visible so
the balloon anchor point is calculated from the center point of the
Line geometry so with a curved line segment the center point is not on
the line itself.

<IconStyle><scale>0</scale></IconStyle>

If the Point scale was non-zero (e.g. 0.1) then the balloon gets
anchored to the point on the line. That size should be small enough
(~3 pixels) to not even appear visible but make the icon 99%
transparent then icon is effectively invisible.

<IconStyle>
<scale>0.1</scale>
<color>03ffffff</IconStyle>
</IconStyle>

shannon9585

unread,
Dec 22, 2009, 12:40:36 PM12/22/09
to KML Developer Support - Advanced Support for KML
Thank You so much!

I'm glad that you have that figured out, so I can just work around it
by setting the Icon scale to 0.1, like you suggest. This seems like
somewhat of a bug though. I would think the balloon should pop up at
the point as long as coordinates are provided. I don't think the
Style elements should influence this at all. Maybe something for GE
to consider in the next version?
Reply all
Reply to author
Forward
0 new messages