Project

silva

0.0
No commit activity in last 3 years
No release in over 3 years
Convert between the GPS (WGS84) location standard and UK Ordnance Survey standards
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0
 Project Readme

How do I use it?

gem install silva

require 'silva'

Silva::Location.from(:wgs84, :lat => 52.658008, :long => 1.716077).to(:gridref)

"TG51411318"

What else can it do?

Silva works with four different location systems:

  • WGS84 (:wgs84, :lat => [latitude], :long => [longitude], :alt => [optional altitude])
  • OSGB36 (:osgb36, params as above)
  • EN (:en, :easting => [easting], :northing => [northing])
  • GridRef (:gridref, :gridref => [gridref] OR :easting => [easting], :northing => [northing])

It can convert freely among each of them using the syntax Silva::Location.from(:system, params).to(:system, params).

Why did you write it?

I needed to convert between WGS84 co-ordinates and Ordnance Survey grid references, and nothing out there quite did what I wanted (although see below). I'm also beginning with Ruby and wanted to get familiar with the idioms and best practices, so creating a gem seemed like a good way to do that.

Anything else?

I began with code written by Harry Wood, who adapted code written by Chris Veness. I subsequently went back over the maths to make sure I understood it reasonably well, and clarified it so that it's easy to check against the resources supplied by the Ordnance Survey. Some of Chris's and Harry's code is probably still lurking in there.

It should be accurate to about 5 to 10 metres.

Silva was written as part of my MSc Project, of which more later.