Crime Data Maps

Crime Data Maps
Posted by on March 1, 2014
Posted in: data visualization, DataViz, mapping, software, tips and tricks

Several months ago, we wrote about Google’s Maps Engine Lite, a fun and easy way to make interactive maps. Since then, we’ve upgraded to Maps Engine Pro, which offers a few more features, such as the ability to measure distances, add more layers, and to import more data.

So we decided to test it out by mapping some crime data. Unfortunately, the data didn’t happen to come in one of the formats Maps Engine Pro can deal with: csv or spreadsheet. When that happens, we have to take the extra step of extracting or converting it. There are several ways to do this; here are a couple we’ve used: Grep and free xml to csv converter from Luxon Software.

Grep is a pattern matching utility for plain-text data files. With a little programming, it is possible to surgically remove just what you need from a large or overly verbose dataset. Here’s a tutorial to give you a taste for how nifty it is. You can run it right inside Text Wrangler by checking the Grep box in the Find and Replace window, as shown here:

The raw data opened in Text Wrangler.

Check the proper box in the Find and Replace window to use Grep.

The resulting data file that can be saved in csv format.

Here’s another dataset (courtesy of*), this time in xml format. Instead of Grep, I used the xml-to-csv converter mentioned above to get the data into the format I needed. Each point represents a Portland 911 dispatch call on Valentine’s Day, color-coded by type of incident (the white markers represent multiple less common incident types). Lots of different things happened all over town, but apparently there was some serious traffic action around SE Hawthorne and Cesar Chavez Blvd! Check it out:

(*Faithful Blog readers may recall another mapping project we did with CivicApps data.)

This is a relatively basic example of how a static set of crime data can be shown on an interactive map (which can be very powerful for describing past events). For a full-featured, real-time data example, check out the work Stamen Design has been doing mapping crime data for the cities of Oakland and San Francisco. And here is more info on the project, with some interesting commentary about the problem of maintaining data visualizations in a constantly-changing technological landscape.

About Ady

Adrienne Leverette is lead illustrator at Fat Pencil Studio. Read more