Converting an address to GPS coordinates using the geocoder gem

require 'geocoder'

results = Geocoder.search("McCarren Park, Brooklyn, NY")
results[0].coordinates
#=> [40.7214457, -73.9524591]

results = Geocoder.search("Lochend, Edinburgh")
results[0].coordinates
#=> [55.9616024, -3.1478808]

Resources