Geoinfo
GeoInfo gem offers comprehensive and reliable databases of localities and zip codes for numerous state of india. Such data may be integrated to professional software, websites, may be used to generate statistics and to various other ends. Gem will provide localities, administrative subdivisions, state and geographical coordinates.
Demo application at https://github.com/diatmpravin/geoinf-demo
(follow readme for installation steps)
This gem allows you to perform the following conversions:
A zipcode to a place
A zipcode to a country
A zipcode to a state
A zipcode to a state code
A zipcode to a district
A zipcode to a Latitude
A zipcode to a Longitude
Installation
Add this line to your application's Gemfile:
gem 'geoinfo'
And then execute:
$ bundle
Or install it yourself as:
$ gem install geoinfo
Example
<%= zip_code.to_region %>
<%= zip_code.to_region(:state => true) %>
<%= zip_code.to_region(:district => true) %>
<%= zip_code.to_region(:country => true) %>
<%= zip_code.to_region(:lat => true) %>
<%= zip_code.to_region(:log => true) %>
<%= zip_code.to_region(:state_code => true) %>
Usage
Convert a zip code to a place
'713301'.to_region #=> Asansol Bazar
'713301'.to_region(:state => true) #=> West Bengal
'713301'.to_region(:district => true) #=> Burdwan
'713301'.to_region(:country => true) #=> India
'713301'.to_region(:state_code => true) #=> WB
Convert a zip code to a STATE
'713301'.to_region(:lat => true) #=> 23.6306
'713301'.to_region(:log => true) #=> 87.1196
Convert a place to a zip code
'Asansol Bazar'.to_region.to_zip #=> 713301
'Mahil Gaila'.to_region.to_zip #=> 144506
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request