mt-osgridref
Ordnance Survey Grid Reference functions.
Installation
$ npm install mt-osgridref
Usage
The module contains methods for parsing and converting between Ordnance Survey grid reference easting/northing coordinates and (OSGB36) latitude/longitude coordinates. It is also a basic representation of an easting/northing coordinate.
var OsGridRef = ;var point = 651409 313177;var latlon = OsGridRef;
OsGridRef(easting, northing)
Creates a OsGridRef object.
- easting (number) Easting in metres from OS false origin
- northing (number) Northing in metres from OS false origin
var point = 651409 313177;
OsGridRef.latLongToOsGrid(point)
Convert (OSGB36) latitude/longitude to Ordnance Survey grid reference easting/northing coordinate.
- point (LatLon) OSGB36 latitude/longitude
var LatLon = ; var latlon = 515136 -00983;var point = OsGridRef;
OsGridRef.osGridToLatLong(gridref)
Convert Ordnance Survey grid reference easting/northing coordinate to (OSGB36) latitude/longitude.
- gridref (OsGridRef) easting/northing to be converted to latitude/longitude
var gridref = OsGridRef;var latlon = OsGridRef;
OsGridRef.parse(gridref)
Converts standard grid reference ('SU387148') to fully numeric reference ([438700,114800]). Returned coordinates are in metres, centred on supplied grid square.
- gridref (string) Standard format OS grid reference
var gridref = OsGridRef;var latlon = OsGridRef;
Copyright and license
The original code was written by Chris Veness and can be found at http://www.movable-type.co.uk/scripts/latlong-gridref.html. It is released under the simple Creative Commons attribution license (http://creativecommons.org/licenses/by/3.0/).
This project is released under the MIT license.