Where’s interesting?

Visualising geographic statistics usually means drawing a coloured map (called a choropleth), but this can be confusing as the human brain tends to associate importance with the area covered. For example, first impressions of the choropleth for the U.S. presidential elections would give the misleading impression that the Republicans won, as 56% of the map pixels are red. However, there is a different style of maps (called cartograms) in which the map is warped such that the area is proportional to the data being visualised.

We can use cartograms of OpenStreetMap data to present a more visually striking and interesting view of the world. For example, here is a cartogram of the distribution of Points of Interest (POIs). It is immediately obvious that most of the POIs in the world are either in the United Kingdom or Germany, but there are other interesting POI-rich pockets; the Philippines, Brasil, South Africa and Eastern Australia. Many thanks to all the contributors in these areas for their fantastic work!

Derived from OpenStreetMap data, CC-BY-SA OpenStreetMap and contributors

Generating cartograms can be quite easy as the authors of “Diffusion-based method for producing density equalizing maps” have generously made their software available online.

First the data needs to be collected. For the case of the POI cartogram, I used the PostGIS database commonly used for Mapnik rendering to extract the geographic distribution of POIs on an evenly spaced grid 1024×1024 pixels in size. When formatted as an ASCII text file, one line per row of space-separated decimal numbers, it can be fed into the cartogram software. This takes a while and tends to converge slowly when the deformation is very large – about 2 hours for the POIs graph on my laptop.

The cartogram software then outputs a 1025×1025 file in the same format giving the new locations for each of the pixel corners in the input file. This can be used to warp a shape file, in this case world_boundaries_m, and render with OpenJUMP to produce the pretty output above!

by Matt Amos, CloudMade London

November 7th, 2008 - Posted by Matt Amos in openstreetmap |