Converts Ordnance Survey grid references into Longitgude and Latitude
Converts Ordnance Survey grid points (UK National Grid, Northings & Eastings) into latitude and longitude
For anyone who has ever tried to get useful location data from Ordnance Survey's Code-Point Open but was stuck with Northings and Eastings, you can use this package to convert those numbers into longitude and latitude.
OSPoint will allow you to convert Northings and Eastings into OSGB36, ETRS89 or WGS84 coordinates. If you're not sure which one you need, you probably just want WGS84.
This package is based on equations provided by the people at the Ordance Survey.
OSPoint will accruately translate Northings and Eastings for the United Kingdom.
New Now supports conversion of Irish National Grid coordinates. Please take care when transforming Irish coordinates - you will need to pass in the name of the proper mercator projection (as demonstrated below).
var OSPoint = require'ospoint';// Create a new OSPoint instance, with Northings & Eastingsvar point = "NORTHINGS" "EASTINGS";// Retrieve OSGB coordinatespointtoOSGB36;// Retrieve ETRS89 coordinatespointtoETRS89;// Retrieve WGS84 coordinatespointtoWGS84;
If your Northings and Eastings data is a Irish National Grid coordinate, be sure to pass in "irish_national_grid" when converting. OSPoint will then use the appropriate mercator projection. For example:
var OSPoint = require'ospoint';// Create a new OSPoint instance, with Irish Northings & Eastingsvar point = "NORTHINGS" "EASTINGS";// Retrieve ETRS89 coordinatespointtoETRS89"irish_national_grid";// Retrieve WGS84 coordinatespointtoWGS84"irish_national_grid";
Things to note
- Northings and Eastings must be a number (no grid letters)
- All transformation methods return an object with longitude and latitude properties in decimal degrees
ETRS89 is a variation of WGS84 that takes into account the slow North Easterly drifting of the Eurasian tectonic plate. The WGS84 and ETRS89 coordinate systems coincided in 1989 (hence the name) and have drifted apart at a rate of ~2.5cm per year due to tectonic movements.
toWGS84() is currently hard-coded to output the same coordinates as toETRS89(). But in reality WGS and ETRS are off by ~50-60cm in 2013. I will implement a more accurate version of toWGS84() some time soon - but this shouldn't really matter given the 5m accuracy of the OSGB36 -> ETRS89 transformation.
95% of the time, people want WGS84