Fix ONS Maps for Power BI

1 minute read

Just when I thought I was out, they pull me back in!

What has changed?

It appears that the map files generated by the ONS have been modified and no longer function correctly in MapShaper without a tweak. This comment on a community post provides all the necessary information to identify and resolve the issue, although it does not explain how to do this in MapShaper. This is all the additional information I will provide here.

The change that has been made is related to the map’s projection. The default projection for files published by the ONS is now EPSG:27700, which is an Ordnance Survey spatial reference mapping created in 1936. While it is excellent for advanced mapping of the UK using sophisticated tools, it is not compatible with a simple mapping tool like Power BI.

The Solution

As mentioned in the comment, in the case of the ONS, you simply need to load your file (GeoJSON, Shape, etc.) into MapShaper, open the console, and paste the following command (including the minus symbol), then press enter:

-proj from=EPSG:27700 crs=EPSG:4326

To see what changes you can type “info” and enter before running the above and you will see the following in the listed details:

CRS:      +proj=tmerc +x_0=400000 +y_0=-100000 +lon_0=-2 +k_0=0.9996012717 +lat_0=49 +datum=OSGB36

Once you run the command above if you type info and enter you will see that the CRS section has changed to the following:

CRS:      +proj=longlat +datum=WGS84

You will also notice that the map has slightly changed shape (it will appear wider), but this will look fine in Power BI and serves as a visual demonstration. You can then make further adjustments to your map and, when ready, export it as TopoJSON, which is compatible with Power BI.