Class: DefraRuby::Address::LatLonToEastingNorthingService
- Inherits:
-
BaseService
- Object
- BaseService
- DefraRuby::Address::LatLonToEastingNorthingService
- Defined in:
- lib/defra_ruby/address/services/lat_lon_to_easting_northing_service.rb
Overview
Converts a WGS84 latitude and longitude to a British National Grid easting and northing. Accurate to around 5 metres.
Instance Method Summary collapse
Methods inherited from BaseService
Instance Method Details
#run(latitude, longitude) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/defra_ruby/address/services/lat_lon_to_easting_northing_service.rb', line 8 def run(latitude, longitude) osgb36_latitude, osgb36_longitude = HelmertTransformation.wgs84_to_osgb36( Float(latitude), Float(longitude) ) easting, northing = TransverseMercatorProjection.lat_lon_to_easting_northing( osgb36_latitude, osgb36_longitude ) { easting: easting, northing: northing } end |