Wednesday, September 18, 2013

Quick and Dirty Mapping with Geographic Data

Barely a day goes by without seeing a map on the web. And the more eye-catching maps are usually fairly involved productions. Consider, for example, Bomb Sight, or the World Water Risk Atlas.  These maps can be quite beautiful, and offer all sorts of capabilities to explore data. But they aren't the kind of mapping I want to talk about here.

I'm interested in a much lower-end question: what can a person do to quickly post his or her geographic data onto a map? Let's say I have a couple of KML files (or GPX, or shapefiles... we'll get to discussing formats in a bit): if I just need to visualize them, what's my best place to go? Let's say that I'm not making a presentation and I don't need to be able to share the data, or let others edit it. Nor do I need visitors to be able to draw on the map.

For the moment I'll also assume that I don't even want to be able to customize how the data looks, or be able to direct others to this quick and dirty map. I'll cover that in a later post.

The user should not have to know anything about the world of GIS. He or she should not have to re-project the data, or convert formats. There shouldn't be a need to understand map projections. There is a broad range of people who receive data -- maybe it's downloaded from the web, handed over by a collaborator, sent by a friend or produced by the company -- and they just want to see it.


GPSVisualizer is probably your best single bet for a quick and dirty map, whether your geographic data is KML, KMZ, CSV or XLS.

On the home page, where it says "Get started now," browse for your data file and click "Go!"
You'll get a small inset map of your data over a Google maps background. If your data included lines, these are summarized in the box in the upper right side of the map.

There are several nice features available to you now:
  • With one click you can go to a full page view of your map. (Click on "view" in the fine print at the top where it says your map is "also temporarily available to view.")
  • You can click on your points or lines and see the data embedded within them.
  • You can change the background of your map, with over 20 backgrounds to choose from. These include Yahoo maps, OpenStreet map, and topographic maps for the US and Canada
  • You can copy that address for the full-page view of your map and send it to others to visit -- at least for a few hours. (GPSVisualizer says the map is there "temporarily". It's probably good for the rest of the day unless use of the site is heavy.)
If you go back a page, back to that "Get started now" box, you can re-generate the map and, instead of getting a Google maps mash-up, receive:
  • a Google Earth (KMZ) version of your data
  • a JPEG image
  • a PNG image
  • an SVG image
  • an elevation profile
  • a GPX version of your data
  • a plain-text
Nice. Simple. Effective.


If the data you have is in the GPX format, GPSVisualizer will still work just fine. (GPX is a format that usually comes out of GPS devices, or software people use to manage their GPSs.) However if you have GPX data, in many ways Hillmap is a more delightful site, and even easier to use.

With Hillmap, you can drag and drop that GPX file right onto either of their double maps. It will upload the file and move the map to view your data. By default the maps a show "map" and "satellite" views, but there are 14 different backgrounds to choose from.
Now you can:
  • Switch to the Input and Output tab, and use the Link To button to get a link to this map, or an iframe tag to paste into a blog post (example below). (Note: set you preferred background before you get the link or iframe code.)
  • Also on the Input and Output tab, you can print your map. 
Hillmap is very clever: they've thought about how awkward most things printed out of web browsers look, and they've created an interface where you can get a decent looking map. You choose the dimensions of the printed map you want, and the dpi. It will then tell you what scaling to apply when sending it to the printer, and open a new tab with just the map image on it.
In Firefox, for example, you go File - Print Preview, set the scale to the given percentage, and hit Print. Very nice results, and, as a real bonus, it has a scale bar on it!

A short digression on formats

There are six common formats that geographic data comes in:
  • KML This is the original Google Earth data format. (KML stands for "Keyhole Markup Language".) You might have a KML file if you drew some points, lines or areas in Google Earth. Or you might have downloaded a KML file from the web. KML files can contain points, lines and areas.
  • KMZ This is a zipped version of KML.
  • GPX  A format for sharing data among GPSs, as discussed above. GPX files can contain points (which they call "waypoints") and lines (which they call "tracks").
  • shapefile This is a format originally created by a company called ESRI, but now used by most GIS software. It's common in academic and scientific circles. Note that a "shapefile" is actually a set of four files. These files all share the same name but have different extensions, like trail.shp, trail.dbx, trail.shx, and trail.prj. When sites ask you to upload a shapefile, they usually want you to zip the four files together into a .ZIP file first. A shapefile can only contain one kind of data: points, lines OR areas.
  • CSV or "Comma Separated Values." This is a plain text file with columns of data separated by, well, commas. Other variants of this format use tabs or semicolons to separate the fields. These files are generated by spreadsheet programs like Excel or OpenOffice Calc, and they can be displayed by those programs. When a CSV file contains geographic data it typically has columns named latitude and longitude. (It's also possible that instead the columns are northing and easting. This means the data is in a UTM projection, which I won't go into that here.) CSV data is usually just the locations of points.
  • XLS Microsoft Excel's spreadsheet format. Like CSV data, it will have latitude and longitude columns, and represent the locations of points.
There are also more obscure ones, like GeoRSS, GeoJSON, and GML, but if you have data in one of those formats you're probably beyond the scope of this post already.


The format we haven't covered yet is shapefile. If you have this kind of data, neither of the two sites above will work, but CartoDB will. 

Like other sites that can accept shapefiles (such as ArcGIS Online and GeoCommons), CartoDB requires you to get a free account and insists that data you upload be publicly discoverable by other users. But it is simpler and more intuitive than those other services.  

Do note the limitations of the free CartoDB account. It will only let you have five uploaded shapefiles (which it calls "tables") at once, 5 MB of data total, and ten thousand views of your map. For our purposes this is not particularly onerous, but note that because a single shapefile can only hold a single kind of geographic data (points, lines or areas), you will be uploading more than one shapefile if, for example, you have both line and points to view.

Once you have your free account, log in and upload your shapefile by clicking on the large "New Table" button with the plus sign on it. Click select a file, locate your zipped shapefile, and when the progress bar finishes you're looking at a table of data for the geographic objects in your shapefile. Click on Map View. and you see the map. From upload to map is pretty fast.

Notice that you can change among the seven background maps (Nokia Day;  Google terrain, roads, satellite, hybrid, grey roadmap, or dark).

If you click on one of your features  you don't see the data yet, but a select fields link is offered, which pulls a set of toggle switches out from the right side of the map. Toggle "on" all the fields you want to see displayed.

To add a second shapefile to the map, you have to first convert it to a "Visualization." (Use the "Visualize" button in the upper right.) Once you give your visualization a name, the Visualize button becomes a "Publish" button. Right below it is a small "+" button which will allow you to add another shapefile (that you've already uploaded) to the map.

Next post: websites of choice for quick styling and sharing of maps.


1 comment:

  1. Hello, for any conversion needed from kml to gpx formats or the other way around, I suggest to have a look at this free converter: and see how it works. You might find it an useful tool.