A full example on how to get latitude and longitude from SimpleGeo's Place API with a US postal address.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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