Monday, October 21, 2019

The More Modern Plague of New York



Over the last week I've become a little obsessed with Nineteenth Century temperance maps of drinking establishments in London and New York. These maps were designed to give the impression that the two cities were overrun by a plague of alcohol.

The temperance maps of New York show that in the Nineteenth Century many areas of the city really were heavily populated by bars and saloons. I thought it would be interesting to see how many bars there were in New York today - in the Twenty-First Century. I also wanted a good excuse to play with Mapbox's new Data Explorer.

Mapbox Data Explorer is a new tool for previewing spatial data in the browser and to carry out spatial analysis of this data. If you upload spatial data to Data Explorer (in GeoJSON, CSV, KML or SHP formats) you can view the data on an interactive map. Using Data Explorer you can then color your data to create choropleth maps or use the Point Binning tool to explore how many points are within defined areas (point binning).

I thought that New York bars would be a great way to test Point Binning in Data Explorer. I downloaded all the bars in Manhattan using Overpass Turbo. Saving this data as a GeoJSON file gave me the points for my point binning test. I then needed some polygon areas. I therefore used Overpass Turbo to retrieve the boundaries of Manhattan neighborhoods. After exporting this data as another GeoJSON file I was ready to go.

Loading the point data for Manhattan bars and the polygon data for of Manhattan neighborhoods into Mapbox Data Explorer enabled me to see how many bars are in each Manhattan neighborhood. I found it very intuitive to work out how to do this in Data Explorer. If you need more guidance on how to do this then you should have a read of Introducing Data Explorer: A new way to quickly visualize data in the browser on the Mapbox blog.

You can view the finished map that I made from my Point Binning test at Manhattan Bars. My map shows the locations of all the bars in Manhattan (as mapped on OpenStreetMap). The bars are indicated on the map with small black dots. You can click on these dots to view a bar's name. The map also includes a choropleth layer (created from my point binning) which is colored to show the number of bars in each Manhattan neighborhood.

*Bad Cartography Warning*
There really is little merit in showing a choropleth layer of the number of bars in each neighborhood. A large neighborhood is likely to have a lot more bars than a small neighborhood because it covers a larger area. A larger neighborhood is therefore likely to be colored more strongly on the map - even though the density of bars in the neighborhood isn't necessarily particularly large. The only reason I decided to color neighborhoods by the total number of bars is because I wanted to try point binning in Mapbox's Data Explorer.

I am impressed with Mapbox's Data Explorer it is an easy to use tool to explore your spatial data in order to look for patterns and stories in your data. However at the moment Data Explorer has one major drawback - that is you can only save your work as a JSON file. After saving my Manhattan neighborhood bars point binning results it took me an age playing around with the saved JSON file to mangle it into a valid GeoJSON file. Data Explorer would be a much more useful tool if you can save the results in a recognizable spatial format - such as GeoJSON, KML, SHP etc. It would also make much more sense for users of Mapbox's other products. For example Mapbox Studio doesn't recognize JSON files but it does recognize GeoJSON. If you could download your Data Explorer results as GeoJSON you could then load your data straight into Mapbox Studio.

Mapbox are calling Data Explorer a prototype. Which suggests they are still working on the finished product. Hopefully support for exporting data in recognizable spatial formats is on the to-do list.

No comments: