Delving Into KML and Google Earth


I want to share a few things that have been really useful for me recently when playing about with Google Earth.  I’ve been using Google Earth a lot recently to view location data about network elements and it’s really useful to use it to compare where the network is to where the customer requirements are.  Now this can be done is your standard GIS system but generally access is limited to such systems, and some might say these systems are slower.  However the key benefit for me in Google Earth is that I can input my own data.

I’ll not however go into detail of how to use Google Earth, I assume you already have at least a working knowledge, which is why you ended up here.

Editing KML?

I was going to kick off by talking about my Google Earth discussions talking about editing KML but while reviewing what I was about to say it became clear to me that editing the KML wasn’t that useful.  I’ve actually found recently that proper structuring of data within Google Earth is quicker and simpler.  However I’ll still do a quick KML overview as reference in case some of you have good XML editing tools. So in simple terms, KML is form structured data a lot like XML, KML is the reference data that Google Earth displays, so if you change your KML file what you see in Google Earth is likely to change.  When you zip up a KML file you get a KMZ file, which you may have seen reference to elsewhere.  KML is very powerful and you can lots of things with it, but I won’t being too much detail about these capabilities, I’ll just reference those bits that I use.  If you more info on KML you can visit the Google reference pages

In order to edit the KML it’s handy to know where it is.  For a long time I emailed myself the KML files from Google Earth but all the data/locations are stored by Google Earth in myplaces.kml…

  • On a Windows 7 PC – C:\Users\Halesy\AppData\LocalLow\Google\GoogleEarth
  • On a Windows XP PC – C:\Users\Halesy\Application Data\Google\GoogleEarth

With KML you’re able to specify a wide range of details about your locations, and create polygons, and specify how your points are displayed, and much much more.  KML is so like XML that you can use an XML editor to edit the KML and I spent a lot of time using XML Notepad from Microsoft for arranging my data and specifying how it looked, but on reflection this was a lot of effort and while it wasn’t wasted, I’ve realised it wasn’t really necessary.  As my KML file got bigger it proved more and more difficult to edit, and after some reflection I could probably have done the same directly in Google Earth.  The key to my effective use of Google Earth is the structuring of data within Google Earth.

google_earth_folders

Google Earth Folders

The images above shows how I have structured my data.  Google Earth basically let’s you create folders, and sub folders, within which you can store your data points.  This then lets you turn on/off folders of interest to make navigation easier/quicker.  So have a think about how your data should be structured and then use Google Earth to arrange, it’s easier than editing the KML.

Editing KML Folders

The above image shows what this looks like in KML.  Each folder in Google Earth has a folder in the KML file, and sub folders where there are ones in Google Earth.  Your locations are Placemarks in KML.  There are a range of options in the KML file, including…

  • Name – Quite obvious really
  • Visibility – Whether or not the folder locations appear when Google Earth opens
  • Description – Again, pretty obvious

There’s loads more options but the Google reference mentioned earlier provides full details.  All this though can be updated directly in Google Earth.

Another thing I spent ages while editing my KML was the icons used to represent my data.  Google Earth already includes a wide range of options…

Icons to Choose From

but there’s a wide range of others out there that you can use.  I found the most useful (free) reference source has been done by Fabio Vergani.  Fabio basically displays an even bigger list of icons that can be used in your maps/Google Earth.  In order to use these icons, or others that you find, you need to go into the properties of each of your locations:

  • Right click on your data point and select ‘Properties’
  • On the dialog box that appears click on the icon for the data point and you’ll see the dialog above
  • Note that in the new dialog there’s actually a reference to a URL, it’s this URL that can be changed to display your new icon

Icon URL Options

  • On the bottom left of the dialog is a button “Add Customer Icon…”, when you click on it you get another dialog that lets you specify your own URL.  This could be one referenced by Fabio, or maybe you could create your own icons (I’ve not tried that)

Within these properties dialog’s there’s lots of options for defining the location, description, style, color etc of your points.  Set up a test data set and have a play.

This info can also be changed in the KML file…

KML Style Options

However specifying formatting of the locations/icons can get quite complicated.  You need to start specifying a StyleMap, then a couple of Style’s and final reference this information via the StyleURL.  I done all this and managing all the styles is probably the most complicated part, not really worth it in my opinion.

So on reflection, I’m not sure it’s worth editing the KML.  Even if you’ve got a large data set it’s probably easier working from Google Earth.  However, if you’ve a good XML editor it’s worth giving it a try to see what works for you.

I’m in the process of writing another couple of posts, one of viewing your KML in Google Maps and the other is the use of Google Fusion Tables to get data into KML format.  This post is long enough though so that info is being added in those other posts.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s