Skip to content

Instantly share code, notes, and snippets.

@rwjblue
Created August 18, 2012 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwjblue/3388463 to your computer and use it in GitHub Desktop.
Save rwjblue/3388463 to your computer and use it in GitHub Desktop.
Use Geokit to validate State and/or Zipcode
require 'geokit'
geo = GeoKit::Geocoders::MultiGeocoder.multi_geocoder('34471')
if geo.success
geo.state # => FL
geo.city # => Ocala
geo.country # => US
end
geo = GeoKit::Geocoders::MultiGeocoder.multi_geocoder('Ocala, FL')
if geo.success
geo.state # => FL
geo.city # => Ocala
geo.country # => US
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment