Tag: KML

The importance of sharing data in KML format

The KML file is an important format in which to share locational data. KML was developed by a company called Keyhole, which Google purchased in 2004, and subsequently released Keyhole’s flagship product: Earth.

A Keyhole Markup Language file is a way to display on a map (particularly a 3D globe of Earth) a collection of points with a defined style. Google has added more functionality and style to the KML format, expanding the styles that can be applied and the information that can be embedded.

KML, like XML (eXtensible Markup Language), is extremely web-friendly. For a web application at work I developed, I included this PHP class that creates an KML file on-demand based on a predefined database query. The file contains locations and attributes of recently installed bike racks in Chicago. EveryBlock imports the file and its information into their location-based service, aggregating many news types around your block.

But a KML file is more important than being the native file for use within Google Earth. It’s an open source text file that can be manipulated by a number of software programs on any computer system on earth (or read on a printed page). It’s not encoded, like shapefiles, so I can read the file with my own mind and understand the data it would present in a compatible map viewer. I see lines of organized syntax describing points and polygons, listing their attributes in plain language.

Have you ever tried to see the “inside” of a shapefile? Only GIS programs can read them for you. KML provides data producers and consumers the opportunities to keep data open, available, and easy to use. We need locational data for our work, and we need tools to help us use it, not hide it.

Converting shapefiles and KML files

Google Earth Pro is a slightly more advanced version than the free edition of the popular satellite imagery application (okay, it does way more, but many people just use that feature). One major additional feature it includes is the ability to import GIS shapefiles and display their features on top of the imagery, including terrain. It’s useful to have your data as KML (Keyhole Markup Language) because KML (or KMZ) is easier to share and Google Earth standard edition is free. But then again, it’s useful to have your KML files as shapefiles because proper GIS software is more powerful at analyzing data. Also, someone might ask you for your data in shapefile format (but they could easily follow these instructions).

Good data management requires options. Options mean your data won’t be locked into a proprietary format. Data want to be free! Read on for ways to convert your KML and shapefile data:

Converting KML files to shapefiles

Like Google Earth Pro, Quantum GIS (QGIS) can convert KML or KMZ to shapefile, and best of all – it doesn’t cost $400 per year (it’s free!). QGIS is a cross-platform application meaning it will run on Windows, Mac OS X, and Linux.

Use QGIS to convert a KML or KMZ file to shapefile:

  1. Click on Layer > Add Vector Layer
  2. Find your KML or KMZ file.
  3. Right-click your new layer and click “Save as shapefile.”

Zonums provides online conversion tools. Or, use ArcGIS and this plugin to convert KML files to shapefiles.

Converting shapefiles to KML files

The freeware Shp2kml 2.o (Windows only) from Zonums will convert shapefiles to KML files. Want some free, interesting data to try it out? Check my ever expanding repository.

ESRI’s ArcGIS can convert KML files to shapefiles using this plugin and then import the shapefile as a layer onto your map.

Creating KML files online

As I described in this post, BatchGecode will generate a KML file for you by inputting a list of addresses and names. Additionally, Google Earth (part of the rising Google GIS platform) creates KML files. Google’s My Maps feature also allows you to generate KML files (for sharing or download) by clicking and drawing points and lines on a map and inviting you to describe the features you create. Use this to get a map of your church congregation, or a map of people who voted for your candidate.

GeoCommons Finder lets you upload geodata in many formats, save it to your profile, and then download it into multiple formats. You can upload a shapefile (.shp) and its accompany files (shx, dbf, and prj), verify that it read your data correctly,

More choices for converting

Additional software with conversion capabilities:

  • MapWindow (another free software choice; Windows only) – An alternative to QuantumGIS and ArcGIS.
  • ExpertGPS (Windows only, not free) – Ideal for GPS device owners, or for researchers using GPS devices in projects. But it can convert the GPS and shapefile data into KML, shapefiles, or a spreadsheet, amongst other functions.
  • Zonums, creator of the standalone Shp2kml software converter, now offers many online tools for KML users, including one that reverses the conversion and exports shapefiles from KML files. I found the link on FreeGeographyTools.com.
  • OpenGeo Suite – Commercial software with non-profit licenses.
  • uDig – Free GIS software, but I haven’t had good experiences with it on my computers.

GeoCommunity has a good article, with screenshots, on how some of these programs work.

Need to work with General Transit Feed Spec (GTFS) data?