Best Zip Code Plugin for Ruby

Best Zip Code Plugin for Ruby

gem install geokit

In IRB:

require 'geokit'
geo = GeoKit::Geocoders::MultiGeocoder.multi_geocoder('90210')
if geo.success
geo.state # => CA
geo.city # => Beverly Hills
end

All Countries States Cities and Zipcodes in a Application

Thanks Guys,

I got all the the countries and states of all of them, but no zip codes.

http://27.org/isocountrylist/iso_country_list.sql

This contains all countries, and there iso-3166 codes ( Siberia code needs to be changed from "CS" to "RS")

And here is the FIPS file for countries with states

http://www.maxmind.com/app/fips_include

For zip code validation I am using

http://www.geonames.org webservices

There is a geonames ruby gem as well, which makes it really simple to do zipcode validations

Hope that helps anybody who needs this information, worth keeping it handy for web projects.

Another Link ( thanks @laise ): http://dev.maxmind.com/static/csv/codes/maxmind/region.csv

What is the ultimate postal code and zip regex?

There is none.

Postal/zip codes around the world don't follow a common pattern. In some countries they are made up by numbers, in others they can be combinations of numbers an letters, some can contain spaces, others dots, the number of characters can vary from two to at least six...

What you could do (theoretically) is create a seperate regex for every country in the world, not recommendable IMO. But you would still be missing on the validation part: Zip code 12345 may exist, but 12346 not, maybe 12344 doesn't exist either. How do you check for that with a regex?

You can't.



Related Topics



Leave a reply



Submit