CANR CLEAR
CLEAR Research

Maps on the Web

Creating Geospatial Data for Your Mashup

The Language of Earth Browsers: KML

Keyhole Markup Language (KML) is a file format used to display geographic data in an Earth browser such as Google Earth, Google Maps, or Bing Maps. KML was developed for use with Google Earth, which was originally named Keyhole Earth Viewer. It was created by Keyhole, Inc, which was acquired by Google in 2004.

A KML file is processed by Google Earth in a similar way that HTML and XML files are processed by web browsers. A KML file is a tag-based structure that contains names and attributes used for modeling and storing geographic features such as points, lines, images, polygons, and models for display in Google Earth, Google Maps and other applications. Thus, Google Earth acts as a browser of KML files. KML has become the standard language for all Earth browsers including Google Earth, Google Maps, Virtual Earth, and ArcGIS Explorer.

The Structure of a Simple KML file

KML Displayed in Google Earth

Basic Elements:
  • An XML header. This is line one in every KML file. No spaces or other characters can appear before this line.
  • A KML namespace declaration. This is line 2 in every KML 2.2 file.
  • A Placemark object that contains the following elements:
    • A name that is used as the label for the Placemark
    • A description that appears in the "balloon" attached to the Placemark
    • A Point that specifies the position of the Placemark on the Earth's surface (longitude, latitude, and optional altitude)

CT Example: CT Environmental Review Team Field Tours

Does That Mean I Need to Be a Programmer to Develop KML?

No! There are many ways to create KML files, from very simple methods to more complex. The simplest kind of KML documents are those that can be authored directly in Google Earth. You do not need to create or edit a KML in a text editor and you DEFINITELY don't need to have any programming knowledge! Placemarks, ground overlays, paths, and polygons can all be authored directly in Google Earth.

Want to learn how? Click this link to learn how to create a KML in just a few easy steps!

What If I Have Existing Data That I Want To Use in a KML?

If you have geospatial data stored in a spreadsheet, textfile, shapefile or even a GPS file (.gpx), you can use those data sources to import the features to KML files. We'll cover two methods here. The first method utilizes the Google Spreadsheet Mapper. The Spreadsheet Mapper is an online Google Docs spreadsheet that you can use to generate a set of placemarks in Google Earth and Google Maps. Because it's part of Google Docs, it allows for collaborative editing, meaning your colleagues on the other side of the country (or just down the hall) can simultaneously enter data and instantly publish updates.

Want to learn how? Click here to learn how to use Google Spreadsheet Mapper to create KML!

The second method for creating KML from existing data is to use a free piece of software called DNRGarmin. DNRGarmin was written by the nice people at the Minnesota Department of Natural Resources. In addition to other wicked cool features, this product allows you to import geospatial data stored in a textfile, database file, excel file, GPS file, or GIS file and then save it to KML. It's really easy to use and best of all it's FREE!

Want to learn how? Click here to learn about creating KML with DNRGarmin!

What if I'm already a GIS-whiz? What tools are available within ArcGIS for creating KML?

Well, I'm glad you asked. There are several tools available for converting GIS data to KML within ArcGIS. One of the best tools available is a free extension for ArcMap called Export to KML.

Want to learn how? Click here to learn how to use Export to KML

So, is your head spinning yet? There are a lot of different methods for creating geospatial data for your mashup. Several of our favorites are listed here, but there are plenty more out there. We recommend doing a little research about what's available and which tools best meet your project needs. The table below provides a brief overview of what is covered above. It may help to get you thinking about what your data needs are and how to get you on your way to creating a KML masterpiece!

KML Generator
Why Should I Choose THAT Method?
Google Earth Point-and-Click! If you still have your KML training wheels on and want to take it slow, OR if you are a KML whiz and just want to create a quick and easy dataset, pointing and clicking inside Google Earth and saving to KML will meet your needs. You can create points, lines, polygons and image overlays within Google Earth and save them to a KML or KMZ file. It's simple, but it meets the mark when it comes to getting the job done!
Google Spreadsheet Mapper If you have existing geospatial point data (with lat/long coordinates) stored in an Excel table and you want to map the placemarks in Google Earth or Google Maps, this is a good option for you. If you are working with a large group of collaborators, it's even better because since it is part of the "Google Docs" family, you can set permissions to allow others to view and edit the database online.
DNR Garmin If you have existing geospatial data stored in points, lines or polygons and you wish to convert them to KML so that others can view them in Earth Browsers such as Google Earth, Google Maps, and Virtual Earth, this tool is for you. DNRGarmin can read GIS shapefiles, CSV textfiles, database files, GPS files and KML. It's a great tool for creating KML and it's FREE!
Export to KML for ArcGIS If you are an ArcGIS user and you would like to convert your GIS data to KML, this tool is better than DNRGarmin because it gives you more control over the output dataset. Export to KML allows a user to select display properties and attribute data to include in the output KML.