0.0
No commit activity in last 3 years
No release in over 3 years
Simplifies converting from longitudes and latitudes, to eastings and northings.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Global Convert¶ ↑

Tool for converting coordinates between different global charting systems.

This tool uses PROJ.4 via the proj4rb gem to convert coordinates between global charting systems with different projections.

Global Convert was greatly influenced by Peter Hick’s blog: Converting OSGB36 (Eastings/Northings) to WGS84 (Longitude/Latitude) in Ruby

Peter Hick’s blog was itself based on Harry Wood’s blog: Ruby code for converting to UK Ordnance Survey coordinate systems from WGS84?

Installation¶ ↑

Global Convert is releases as a gem. So either:

gem install 'global_convert'

or add this to your Gemfile:

gem 'global_convert'

UK Ordinance Survey National Grid references to Longitude / Latitude¶ ↑

require 'global_convert'

easting = 529978
northing = 186491

location = GlobalConvert::Location.new(
  input: {
    projection: :osgb36,
    lon: easting,
    lat: northing
  },
  output: {
    projection: :wgs84
  }
)

puts "Latitude = #{location.lat} in radians."
puts "Longitude = #{location.lon} in radians."

OS Map References¶ ↑

If you need to start from an OS Map Reference, rather than Eastings and Northings another gem os_map_ref can be used to convert the map reference to eastings and northings.

Projections¶ ↑

Projections are defined via /data/projections.yml. This contains a labelled list of PROJ.4 projection configurations. To use an alternative set of projections, define your own projections using the same format as projections.yml and register that with GlobalConvert.

GlobalConvert.projection_file_path = 'path/to/alternative/projections.yml'

Additional projection configurations can be found at:

The options are documented on the PROJ.4 site.