Provides Geography information from the US and world (ie. US states list with abbreviations and names, World countries list, etc.)
States class containing information about the US states and territories.
World countries list
US zip codes list and tools
gem sources -a http://gemcutter.org sudo gem install
INSTALL FOR RAILS
Add to environment file:
config.gem "geographer", :version => '1.1.1', :source => 'http://gemcutter.org'
You will need to create classes and include modules in order to use geographer. You can do this in the lib directory, an initializer, etc.:
class States include Geographer::Us::States end
The examples are based on the States class created above.
For a list (array) of state abbreviations:
For a list (array) of state names:
For a list (array) of state abbreviations with US territories:
For a list (array) of state names with US territories:
For a list (array) of territory abbreviations:
For a list (array) of territory names:
To look up the full name from the abbreviation:
States.abbreviations_name_map['AL'] # returns 'Alabama'
(The MIT License)
Copyright © 2009 C. Jason Harrelson (midas)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.