Journalist’s guide to mapping data by county, district using ShpEscape
If you're mapping data by county, ZIP code, congressional district or any kind of region, points just don't cut it.
You need shapes.
Fortunately, the U.S. Census and many municipalities provide those shapes in the form of "shapefiles." These typically have the extension .shp, and use a format originally designed for cartographers wielding sophisticated (and pricy) software, like Esri's ArcView.
But thanks to a nifty, online tool called ShpEscape, you can use them, too. For free. And once you have shapes to play with, there's a lot you can build.
Getting in .shp
Here's how to convert shapefiles into a format you can use for data display:
- Find the appropriate shapefile for your project online, and download it to your hard drive. Municipal planning agencies are a good place to look. Try searching for "shp." If you just want to try one, use this county map of Minnesota from the Census Bureau's shapefile page.
- "Shapefile" is a bit of a misnomer. Each "file" is collection of files that work together and have extensions such as .shp, .prj, .shx, and .dbf. ShpEscape wants all of those files compressed or "zipped" together. You probably downloaded them that way, but if they're separate, zip them together using File => Compress on a Mac, a program like WinZip on a PC, or gzip in Linux.
- If you don't have one already, sign up for a free Google account.
- Go to Google Fusion Tables and log in using your Google account.
- Then go to ShpEscape.com.
- Follow the prompts to authorize ShpEscape to access your Fusion Tables.
- Click "Choose File" and "Upload" to upload your shapefile.
- Wait a bit. Depending on the size of the file and traffic on ShpEscape, this will probably take several minutes. The status updates can be misleading, so be sure you don't stop it too early. The process is done when Total Rows is the same as Rows Inserted (not Rows Processed).
- Click the Fusion Tables ID number, which will take you to the new table with each individual shape on a separate row (each county in my example case).
- To see your shapes on a map, click Visualize => Map. Your shapes should appear in red. It takes a few moments to load the first time. (Pro Tip: Count to 10, and then zoom in one click.)
Playing with shapes
From here, you can do a lot. You can shade each shape based on its metadata. Here, for fun, I shaded the Minnesota counties based on the area of the water in the county.
Or you can merge your shape table with another table full of data -- using a value appearing in both tables to "link" the two together. That link might be a five-digit Zip code, a FIPS code (for counties), or a GEOID (for Census tracts, blocks, etc.). For example, I shaded this map of New York State Assembly districts based on whether they were over or under their target population.
Once you have a map you like, you can use the "Get link" or "Get embeddable link" features to put them right into an article or blog post. (There's more information on playing with Fusion Tables here and here.)
You can take it with you
If you want to use the information in a spreadsheet or other database, use File => Export and you'll download a .CSV (comma-separated values) file with one shape per row.
A nice feature of this is that the column that describes the shapes -- a collection of points, lines and polygons -- is now formatted in Keyhole Markup Language, or KML. That's useful for building custom layers onto Google Maps.
Have at it
See what you can do with data you have, and email me about your successes -- or if you have questions.
This story is part of a new Poynter Hacks/Hackers series. Each week, we’ll feature a How To focused on what journalists can learn from new tech tools and emerging trends in technology.