Wednesday 11 November 2009

British National Grid and Google Maps

This post follows on from a recent one about the Scottish Index of Multiple Deprivation 2009 and in particular the interactive mapping function they provide.

The most deprived area in Scotland, according to the new Index, just happens to be centred on Celtic Park, Glasgow. This is, in technical terms, Data Zone
S01003279. But, there's a slight problem - the Data Zones are somewhat displaced. It's not too big an issue in relation to the SIMD data because Data Zones match Ordnance Survey data and the Scottish Government have all this behind the scenes so they do of course know on a street-by-street basis where things are.

However, for the online map interface, it does mean that the Data Zone is not in the right place. It also means that people using the interactive mapping facility could end up thinking they live in one area, when they actually live in another since the level of displacement often moves Data Zones into the wrong street.

So, it got me thinking. What would you have to do to get the Data Zones in the right place on Google Maps (this also applies to Google Earth)? It's quite simple really (if you're a nerd and you have the right software)... N.B. the SIMD data is not based on Google Maps, but rather the Microsoft Virtual Earth mapping facility.

  1. Convert the Data Zone Shapefile from British National Grid to WGS84 in ArcGIS. Best done via ArcToolbox/Data Management Tools/Projections and Transformations/Feature/Project and then selecting the right files for transformation to the correct projection. More useful information can be found here.
  2. Use Kevin Martin's excellent Export to KML tool to convert the Shapefile to KML. You can set transparency here and it will export as a transparent KML layer, as in the maps below.
  3. If you've got a Google account you can then upload the KML file directly into the My Maps facility and the Data Zone appears there. From there you can add a description and edit in other ways.
Here's what it looks like if you don't get the projection right the first time (click the link below the map to see the full thing) - note how the edges of the Data Zone don't match the streets.

View Data Zone S01003279 - Displaced in a larger map

And here's how it looks if you convert to the correct projection before you export to KML (again, click the link below the map to see it full size):

View S01003279 in a larger map

So, a simple bit of GIS work before putting all this online solves the problem.