The project is in a healthy, maintained state
Transforms OS National Grid (OSGB36) to WGS84 coordinates using official Ordnance Survey methods.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

OsNationalGrid

Gem Version

OsNationalGrid is a Ruby gem that provides accurate transformations between the Ordnance Survey National Grid (OSGB36) and WGS84 (latitude/longitude) coordinate systems.

It uses the official mathematical transformations from the Ordnance Survey, including a Helmert transformation for precise conversions between coordinate systems.


Installation

Add to your Gemfile:

gem 'os_national_grid'

Then install:

bundle install

Or install it manually:

gem install os_national_grid

Usage

Convert from OSGB36 (easting, northing) to WGS84 (longitude, latitude)

lng, lat = OsNationalGrid.os_ng_to_wgs84(481_987.066, 213_552.27)

=> [-0.812036, 51.814605]

Convert from WGS84 (longitude, latitude) to OSGB36 (easting, northing)

easting, northing = OsNationalGrid.wgs84_to_os_ng(-0.812036, 51.814605)

=> [481987.066, 213552.27]

Development

Run the test suite with:

bundle exec rake test

License

The gem is available as open source under the terms of the MIT License.