Heat Map of Massachusetts Liquor

Never Far from a Drink

Posted by Will on March 27, 2014

Best Laid Plans

When I set out to make a heat map of the Massachusetts liquor licenses I had assumed that getting the data would be the least of my concerns. I was looking forward to a project focused on the design of a heat map, so using a readily available data set would do just the trick. After all, this is public data, what could be difficult about that?

As you might have guessed by the lead up, the punch line is that getting the data in a format that made sense for this project proved to be an enormous pain.

Massachusetts in all its infinite wisdom has decided, unlike other states, to make their liquor license data as inaccessible as possible. Sure, I could pay $40 for a formal data request, but I’m just making a silly map, so that’s not going to happen. Instead I trolled the internet looking for the some fortunate posting that would solve my problem. Fortunately I was able to track down a CSV off of a GIS forum, so everything is in order, right?

Well not quite - it turns out for one reason or another both GIS and Tilemill, which I’d be using for the map data, refused to parse the address data in the CSV, and after many attempts to reconfigure I gave up. You know what doesn’t fail? Latitude and Longitude! Time to geocode me some addresses.

Slowly but Surely

Writing own geocoding parser using Google Maps API ~50-60 Results

Mapbox recommended Google Docs addon ~200-400

Online solutions for using Mapquest API ~ 500 Results

Google Refine using Google’s Geocoding API ~2000 Results

Final Result (after running Google Refine a few times) - 8500 Results in Lat/Long Format

Using the Mapbox recommended script to put the results in a GeoJSON

Styling the Data

Since I’m new to working with the heat map tools in GIS I did get a result in the color I wanted, but the map just didn’t feel interactive with that method.

So again taking a page from a Mapbox post - I cheated - using transparency to mimic a heat map appearance. Combine that with some zoom specifications and some textures in CartoCSS and we have.

Ta-Da!

The final Map

Mapbox Map

Original CSV | Excel format with Lat/Long | Data in GEOJson format