Pages

Wednesday, April 08, 2009

How to Create a Legend in Google Earth

Update August 7, 2010:  Now with easy copy and paste text of the code!

For my Russia-Georgia War maps I had a fixed non-movable legend in the bottom left corner of the screen. I preferred the legend because it provided a solid reminder of what date was being shown and it promoted the blog.

I have received several requests for the code to create the legend so below is the code.

First, create a legend in an image editing software and save as an image file like .jpg, .bmp, or .gif. Second, open Notepad. Then type/copy in the code below into Notepad.
Only the name, description, and icon data need to be changed. The icon path should be something like "c:\maps\russiageorgia\legend.jpg
 



<ScreenOverlay id="legend">
<name>Give the file a display name</name>
<description>Write what you want displayed in the properties textbox</description>
<Icon><href>Write the path to the legend image</href></icon>
<overlayXY  x="0" y=".055" xunits="fraction" yunits="fraction"/>
<screenXY  x="0" y=".055" xunits="fraction" yunits="fraction"/>
<rotation>0</rotation><size x="0" y="0" xunits="pixels" yunits="pixels"/>
</ScreenOverlay>


When the text is inserted save the file as something like "legend.kml". Make sure the file is not saved as a text file. Now go into Google Earth and open the saved kml file. Your legend should be displayed. Using Google Earth you can make it change how opaque it is.

14 comments:

Jordan said...

good, simplified advice

Anonymous said...

Gr8 work.. Its woking fine.. Thanks:-)

Anonymous said...

Thanks for that, it's very clear. However I had two minor issues:
- I had to retype the '"' symbol, as GE did not like the ones copied directly from the blog.
- I had to capitalize /Icon at the end of line 4.

Cheers

Cedric

Anonymous said...

Thank you ! This also worked for me but I had to do the same as Cedric in replacing the "" symbols and capitalizing /Icon at the end of line 4.

Keith said...

it looks like it is working but the balloon is the only thing showing. I can zoom out to display the entire earth and the actual legend is still off the screen and I am unable to view it. I'm using 6.2.1

Catholicgauze said...

Keith,
I'll look into it.

Keith said...

Please disregard. After reviewing the code there were quotes around the file location. All is well and thank you for the information!!

Catholicgauze said...

Keith, will do. Good to hear and glad the blog proved useful!

Anonymous said...

Worked great and super easy. Thanks for the help.

Anonymous said...

I can get it to load, but my image takes up the entire screen, no matter how far I zoom in or out. What could be causing this? Does it have something to do with "replacing the quotation marks"? Any help is appreciated.

Catholicgauze said...

Hi anonymous,
Try either using a smaller logo or modify the size x and y.

Catholicgauze said...

Hi anonymous,
Try either using a smaller logo or modify the size x and y.

Anonymous said...

I just shrank the size of the icon file in Paint, as you suggested. That worked! Thank you!

Unknown said...

Doesn't work. I get 'mismatched tag' error.