Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A full example on how to get latitude and longitude from SimpleGeo's Place API with a US postal address.
# Using Ruby 1.9.2
require 'simplegeo'
require 'json'
full_address = "960 West University Dr #103 Tempe, AZ"
geo_options = {'radius' => 0.1}
closest_locations = SimpleGeo::Client.get_places_by_address(full_address, geo_options)
coordinates = JSON.parse(closest_locations.to_json)['features'][0]['geometry']['coordinates']
longitude = coordinates[0]
latitude = coordinates[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment