Thursday, October 19, 2006

Viewing KML

KML (Keyhole Markup Language) is the code that allows users to depict geographic features such as points, lines, images, polygons, and models in Google Earth. It is the HTML of Google Earth (and Google Maps).

You can see how KML works in a variety of ways, including:
This last method is very helpful because you can see the feature first in Google Earth and then view the KML behind it. For example, you can view the KML of a placemark or other content and see how it is created and structured.

There are a several ways to view the KML source of existing content in Google Earth:
  • Right click (CTRL click on the Mac) an item in the Places panel. Choose Copy. Open a text editor (e.g. Notepad) and choose Paste. The KML for the item appears in the text editor.
  • Right click (CTRL click on the Mac) an item in the Places panel. Choose Save As and save the file. Open this file in a text editor.
You can edit these files and open them again in Google Earth, provided you follow the conventions of KML as described in the documentation.


dbman5 said...

Well, I wrote a nasty comment about people who create Help files but I see that you are the author of the GE Help so I'll tone it down and just state the facts.

I've spent over an hour reading the tutorial and trying to figure out how to actually use and implement a KML file and can't figure it out. When I copy a point of interest as described in the tutorial, save it with a .kml extension and try to open it using "File/Open" in GE (that's what the tutorial seems to recommend and it sounds simple enough), all I get is an error message.

I have a B.S. in Mech. Engrg., a Masters in Bus. Mgmt, an amateur radio license, was a certified master auto mechanic for many years, had a residential builder's license for awhile, designed and built my own house, and currently build custom databases for desktop or web and am nearly finished with getting my private pilot license. So, yes, I generally learn new things rather easily. In fact, I like learning new things. And, I have also built Help files for my database users so I have some experience there.

Help files and tutorials need to work for new users but most of them seem to be written at a higher level. Of course, they have to be written by someone who already knows the subject which makes it difficult to come down to a beginner's level. However, there is always the possibility of review by someone who is NOT familiar with the topic before the file is published. At the very least, it should be reviewed and the instructions followed by someone else and that person should be instructed to try doing it as though they knew nothing about the topic - just follow the instructions, don't assume anything, and see if you get the correct results.

Now, can anyone point me to something that tells me how to actually create and implement a usable .kml file? One simple example of a finished product would probably be enough. Maybe it's actually in the files I was reading but, if so, somehow I've been missing it.

John Gardiner said...

Is this a local file (i.e. on your hard drive)? Have you edited the file at all?

joz said...

My guess is that you've pasted the KML into a text editor that adds character formatting of some sort to the file. A KML file must begin with exactly these two lines (no spaces or formatting characters at the start):

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="">

We are currently revising the KML Tutorial, and this basic file information is included at the beginning of the tutorial. We hope the new tutorial will better fill the needs of new KML users.

In the meantime, for more KML assistance, please check out our support forum.

dbman5 said...

I should have emphasized before the word IMPLEMENT. The problem isn't building the kml file - it's what to do with it once it's built. If I give you all the instructions to build a Framus to increase the efficiency of your furnace and then just tell you to "install it" but don't tell you how to actually install and use it, what good is it? There's plenty of info on building a KML file but where does it tell you how to actually use/open the file. It does say "open with Google Earth" but what does that mean? "File/Open" didn't work so either there is another way or something is wrong with my system and causing an error. Maybe the answer is in the 'help' somewhere. As I said, it's probably simple; I just can't find it. (It's usually the simple stuff that trips people up.) Having the file doesn't do much good if you can't figure out how to use it. That's where the Help/Tutorial needs improvement - IMHO.

For what it's worth:

I have checked the forums but have not been successful in finding an answer. I suspect that I am missing something simple since there are obviously many people already using them. I will post my own question and will hopefully get a suitable answer.

And, yes, I have created a kml file on my local hard drive and it is in text format with no other formatting info. But, how do I open/run it??

dbman5 said...

Ahah! It WAS an error of some kind on my system. If I had only known that "File/Open" was supposed to work!