How to convert Eastings and Northings into Longitude and Latitude

In a recent personal project of mine, I wanted to explore and map UK renewable infrastructure projects using government data:

https://www.gov.uk/government/publications/renewable-energy-planning-database-monthly-extract

This dataset had everything I needed, EXCEPT for the fact that the coordinates of infrastructure were not based on global latitude and longitude (as used by Tableau), but rather eastings and northings based on the UK OSGB (Ordinates Survey National Grid) whereby any UK location is described in terms of its distance from the origin (0,0) just west of the Isles of Scilly.

What to do? I needed to convert these points into Tableau recognised longitude and latitude. In my research I found that the British Geological Survey had offered the following meaty SQL function for converting coordinates in bulk:

Which I am sure would work. But frankly I felt there must be an easier way, and after chatting with my colleagues it was recommended that I further explore Tableau's MAKEPOINT() function.

I already knew that MAKEPOINT() could convert latitude and longitude coordinates into a spatial object: MAKEPOINT(latitude, longitude)

What I did not know is that you could pass in a third argument into this function: a Spatial Reference System Identifier (SRID). This is a unique value used to identify local spatial coordinate systems utilising ESPG reference system codes. There is a whole list of them here:

Coordinate reference systems
EPSG.io: Coordinate systems worldwide (EPSG/ESRI), preview location on a map, get transformation, WKT, OGC GML, Proj.4. https://EPSG.io/ made by @klokantech

This allowed me to locate the following:

upload in progress, 0

Once you find the relevant ESPG, in my case 27700, simply plug it into the third argument of your calculated field!

Each row of data will now have a spatial object attached that Tableau can place accurately onto global latitude and longitude coordinates, happy days! I was now able to plot my map:

Author:
Dominic Brady
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab