Tag: Software

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?

Geocoding in Quantum GIS – QGIS

Geocoding is the process of turning street addresses into geographic coordinates. You can geocode easily in QGIS using several methods.

If you just want to geocode and you don’t need to see the addresses plotted on a map in QGIS, then follow these instructions. If you don’t need to see them on a map nor do you need the geographic coordinates, then use BatchGeocode.

If you only need to geocode a single address and get its coordinates immediately, use geocoder.us.

An example geocoded address on the map using the “single address” method.

How to geocode multiple addresses in QGIS

UPDATE April 11, 2013: Updated the directions because the “Add delimited text layer” function moved from the Plugins to Layer menu. 

UPDATE March 24, 2011: I updated the directions to use GPS Visualizer instead of BatchGeocode.com because BG stopped giving geographic coordinates in its output.

Get directions on geocoding a single address in QGIS with a plugin.

QGIS is an open-source Geographic Information Systems (GIS) application that has been gaining ground since 2004. It runs on all operating systems (it began as a Linux project) and you can download it for free.

I use it often because ESRI doesn’t make the popular ArcGIS software for Mac. That’s unfortunate, but like I said here, software, technology and mapping issues can be easily overcome – we can use QGIS to create maps. QGIS, though, is missing one major feature for basic map building: geocoding.

Here’s a step-by-step tutorial on how to bring in multiple street addresses and their XY coordinates into your QGIS map en masse: Continue reading

GIS and mapping tools

Some of the work I do for school and my job requires that I make maps. I’ve never taken a class on how to make maps or analyze data sets featured in maps (what GIS does), so I learn as I go.

There’s no one around me I can call upon when I have questions that need immediate answers. Well, there’s me! Because of this, I must quickly find a solution or workaround myself.

Today I had to import a list of Chicago Transit Authority and Metra rail stations into ArcGIS so I could plot them on a map that also showed Chicago’s boundary and our bikeways. I could do this in Google Earth, but then I would have less control over the printed map I wanted to make, or the image output. ArcGIS has a built-in geocoder and I learned how to use it six months ago, but a skill not practiced is lost – and I forgot how to do it.

That’s okay – what follows is how I overcame this barrier:

Because I know how to use PHP to instantly create Keyhole Markup Language (KML) files (the format which Google Earth and Maps speaks fluently). Then, with this user-contributed KML to SHP plugin for ArcGIS, I was able to convert my KML files to Shapefiles and display them on my map. Unfortunately, my custom “fancy” icons were lost in the translation. Supposedly this alternate user-contributed script does the same thing.

Other tools I used to get my map created:

  • BatchGeocode.com – This site is indispensable for turning a list of addresses (with names, descriptions, and URLs) into the same list but with latitude and longitude coordinates! It will even create a KML file for you.
  • KML Generator (PHP class) – This class allows you to quickly and easily create KML files from any array and array source of coordinates. I store the transit stations in a database and run a query on the database and loop through them to generate the points in a KML file.

I’d like to thank James Fee’s GIS Blog for the links to the ArcGIS scripts/plugins I used in my project. To everyone else who must confront software, technology and mapping roadblocks, there’s almost always a solution for you.

Read about how I got around QGIS’s lack of geocoding.