Ruby bindings for the Proj coordinate transformation library. The Proj library supports converting coordinates between a number of different coordinate systems and projections.
Next install the Proj library. This varies per system, but you want to install the latest version possible. Once installed, you'll need to make sure that libproj is on your operating system's load path.
Then install the gem:
gem install proj4rbrequire 'proj'
# Create a transformation between two coordinate systems
transform = Proj::Transformation.new('EPSG:31467', 'EPSG:4326')
# Transform a coordinate
from = Proj::Coordinate.new(x: 5428192.0, y: 3458305.0, z: -5.1790915237)
to = transform.forward(from)
puts "lat: #{to.x}, lon: #{to.y}"Full documentation is available at https://cfis.github.io/proj4rb/ including:
See Configuration for details.
PROJ_LIB_PATH- Override the path to thelibprojshared library.PROJ_DATA- Path to the folder containingproj.db(Proj 6+). Must be set before Ruby launches.
proj4rb is released under the MIT license.
The proj4rb Ruby bindings were started by Guilhem Vellut with most of the code written by Jochen Topf. Charlie Savage ported the code to Windows, added the Windows build infrastructure, rewrote the code to use FFI and then ruby-bindgen, and updated it to support Proj version 5 through 9.