View Full Version : Removing the annoying directions text in a placemark bubble
SpiderX22
01-06-2009, 09:39 PM
I was just working on a file and remembered just how annoying the "Directions: To Here - From Here" thing automatically at the bottom of every placemark was. So, I'll share with you a useful, and really quick way to eliminate it (it replaces it with a blank space). At the end of your description, put a single table tag, ie:
<table>
Works like a charm. Just don't put an end tag after it.
tpstigers
01-07-2009, 04:58 PM
Another method -
From the KML Reference:
<text>
Text displayed in the balloon. If no text is specified, Google Earth draws the default balloon (with the Feature <name> in boldface, the Feature <description>, links for driving directions, a white background, and a tail that is attached to the point coordinates of the Feature, if specified).
You can add entities to the <text> tag using the following format to refer to a child element of Feature: $[name], $[description], $[address], $[id], $[Snippet]. Google Earth looks in the current Feature for the corresponding string entity and substitutes that information in the balloon. To include To here - From here driving directions in the balloon, use the $[geDirections] tag. To prevent the driving directions links from appearing in a balloon, include the <text> element with some content, or with $[description] to substitute the basic Feature <description>.
SpiderX22
01-07-2009, 05:15 PM
Another method -
From the KML Reference:
<text>
Text displayed in the balloon. If no text is specified, Google Earth draws the default balloon (with the Feature <name> in boldface, the Feature <description>, links for driving directions, a white background, and a tail that is attached to the point coordinates of the Feature, if specified).
You can add entities to the <text> tag using the following format to refer to a child element of Feature: $[name], $[description], $[address], $[id], $[Snippet]. Google Earth looks in the current Feature for the corresponding string entity and substitutes that information in the balloon. To include To here - From here driving directions in the balloon, use the $[geDirections] tag. To prevent the driving directions links from appearing in a balloon, include the <text> element with some content, or with $[description] to substitute the basic Feature <description>.
Can you show me an example? I'm kind of confused by the big words. :yep:
Forkboy2
01-07-2009, 05:55 PM
Just add this to the Style element.
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
Probably more valid code than your suggestion with the <table> tag.
Matt
SpiderX22
01-07-2009, 05:59 PM
Just add this to the Style element.
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
Probably more valid code than your suggestion with the <table> tag.
Matt
Haha that's true. =)
I tried it and it's being weird. So, say my description text is:
<center><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Mount_Whitney_2003-03-25.jpg/300px-Mount_Whitney_2003-03-25.jpg"><br>Mount Whitney is the highest summit in the contiguous United States with an elevation of 14,505 feet (4,421 m). It is located at the boundary between California's Inyo and Tulare counties. The western slope of the mountain lies within Sequoia National Park and the summit is the southern terminus of the John Muir Trail which runs 211.9 miles (341.0 km) from Happy Isles in Yosemite Valley.<br><br>http://en.wikipedia.org/wiki/Mount_Whitney
How do I use what you showed me? All I got was either nothing, or the same text three times.
Munden
01-07-2009, 06:20 PM
Just add this to the Style element.
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
Probably more valid code than your suggestion with the <table> tag.
Matt
The difference is that this is the correct, supported way to do it. You won't be guaranteed that the other method with a missing closing tag will continue to work. Also, this is much more powerful as it lets you properly define the balloon and there are MANY more tags such as those for colors.
Using it means editing your KML file. To use this, you put the BaloonStyle in the a style tag that's used in your KML file. You'll see sections like this:
<Style id="sn_icon24">
<IconStyle id="innerstyle_nodirections">
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal4/icon24.png</href>
</Icon>
</IconStyle>
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
</Style>
Then when it has a placemark, noted by the <Placemark></Placemark> tags, you'll see a tag in there pointing to one of your icon styles. The tag looks like this:
<styleUrl>#sn_icon24</styleUrl>
If you only have one style, you only need to make a single edit. A style can be used by more than one placemark, of course. If you just want to change a style or styles you don't need to change the reference in the Placemark, but it's good to know which style is being used by which Placemark sometimes.
SpiderX22
01-09-2009, 12:17 AM
That seems like a very time-consuming process..having to open the kml for every placemark and then manually editing it, especially when your working with hundreds of placemarks..
Also, I see you're using the word kml. So, does this not work if I'm using a kmz file (I know the difference). When I opened my file in notepad I got this junk:
PK <0û3© I doc.kmlíUmoã6þœþ
Îû°; µüÞdP}8ÜaX‡u(ÐvÃp8ª£ØZdÉ“äk³_?JÎ[{Ý>ìó’!EêáCJ¤é»§^Ân¬Ðê"Jã$®½ª½ˆîn8›GïêºF/ôTö"Ꜿ'„3㺸պ•<ntOÐ…dq¡÷GÝŒ=W®>™QÅz^_éQ9øNñM¼îÿ¢$¬£ýÆm$±¼ˆ¬ºgÂÚ8ëQf3zÙhì^›ÑFKmê¢Y…%“L¶aè•Ä%“Výþ ÍhgøªÞRïÙ`™£¾’Û‚íØ€âŽI<¨–’°;@’=&í´»´ƒ§‹(‰Ë6øÁÓ¨„Ã2k×_®y–ý™=pùU²ójY¾’lgGÉRò€’½tTàn_àÿ\ßó¿ÿùÕ"_±!Ô¹?ºÉÉTékÔ'Ü5ßÔJ›žIJ¼<óÛ¿=nŒ¼[Áw /Ð:Ñv÷:àáÐÿo›²÷ʵd
ï™YŸ¯»wß¹3ºä¶1bðå®é7Ÿ>||ûþm°ñ¹©©è[°¦ÙŒqš-ãG±=_
kÓ¯
^ÃÒ÷½V–¸nìÈŠ¬$Ľ߯½Ï’$?Ã_VÆ-É“dx:û7—¨¦æ9y\ÇÁ—Œ[vì{á@¨°ŠWʼnvÔ£…;¼M| 7Ž9náQ¸˜.ùæÓ½‚´8-“Vœ;xSœY
ýÛ."uÃ< sùI,™ÙÀwœ+øÀ¤Xi£ûÎÂ¥Úh„_Âí(™ñ<²à6†[ÜûˆD¹Q`¥¸ì{ï·[~(ßð?G-ü82 ×xŒØoÙå:UÀêÿ±{¡0å-òOºSp5
·† h:0£²¥i¼€Þw1¼É|YÀº+£{ø‘
Ã.·!•ßµåïLJùþ$ÂÃÀ·ùá-¢âýØ_ˆçÕ7z4
§„ÕŸ?×”_»ÐÔZ¯ß»éÞKZáÆ%¯ÏÒ,‰óó´ªæçe9ÏlïƒurÆ: -¯â´ÊYž%èš–9ºîlÁ“É– yl1Lµ8&Õ"OâżœWiZÌ1Öd>NHW/pk¦±Æ™Å"ˤˆËîH‹4¯Rìùiš7ûÜŽZúÙ|yÑÔ×Z(·nÚ ’¿Á'ÇYY•Y:_ É<;ŤQ¨Šj^”ÕyŸ&~ öL3b‹‡Òa0PrxÃS?Ðë“¿PK <0û3© I doc.kmlPK 5 Î
Munden
01-09-2009, 01:11 AM
Yes, well if you know the difference then you know that a KMZ is just a KML file that's been put into a ZIP archive so you can't edit it. I'm not sure why you mentioned it, but yes you either save as a KML file and edit that or change the KMZ tag to ZIP and unzip the file and then change doc.kml to something that better denotes what's in the file.
I can rapidly edit a KML file using repeating edit replacement commands in the window, whereas I when messing around with individual placemarks, it's a royal pain because I have to edit each placemark individually. Plus, to reiterate, I often add other tags for colors or background images and that sort of thing. Also, if they ever do fix GE to handle missing ending tags, you'll have to go back and edit everything again. They might not ever fix it, but they might .. or might switch or update the XML/HTML library they're using which just happens to include the fix. (I'm assuming at least some aspect of what they're using is an externally produced library to save time)
tpstigers
01-13-2009, 03:07 PM
Here:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Mount Whitney.kml</name>
<StyleMap id="msn_ylw-pushpin">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin</styleUrl>
</Pair>
</StyleMap>
<Style id="sn_ylw-pushpin">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
<ListStyle>
</ListStyle>
</Style>
<Style id="sh_ylw-pushpin">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
<ListStyle>
</ListStyle>
</Style>
<Placemark>
<name>Mount Whitney</name>
<description><![CDATA[<center><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Mount_Whitney_2003-03-25.jpg/300px-Mount_Whitney_2003-03-25.jpg"><br>Mount Whitney is the highest summit in the contiguous United States with an elevation of 14,505 feet (4,421 m). It is located at the boundary between California's Inyo and Tulare counties. The western slope of the mountain lies within Sequoia National Park and the summit is the southern terminus of the John Muir Trail which runs 211.9 miles (341.0 km) from Happy Isles in Yosemite Valley.<br><br>http://en.wikipedia.org/wiki/Mount_Whitney]]></description>
<LookAt>
<longitude>-118.293424000644</longitude>
<latitude>36.5782680003373</latitude>
<altitude>0</altitude>
<range>999.0076275898736</range>
<tilt>0</tilt>
<heading>-6.361109362927033e-015</heading>
</LookAt>
<styleUrl>#msn_ylw-pushpin</styleUrl>
<Point>
<coordinates>-118.293424000644,36.5782680003373,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
Forkboy2
01-13-2009, 05:18 PM
I use a program called UltraEdit a lot. It's a great text editor that will let you do things like automatically add the same 10 lines of code to 1,000s of KML files.
Matt
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.