README.md in offline_geocoder-0.1.0 vs README.md in offline_geocoder-0.2.0

- old
+ new

@@ -1,5 +1,10 @@ +[![Build Status](https://travis-ci.org/sildur/offline_geocoder.svg)](https://travis-ci.org/sildur/offline_geocoder) +[![Code Climate](https://codeclimate.com/github/sildur/offline_geocoder/badges/gpa.svg)](https://codeclimate.com/github/sildur/offline_geocoder) +![Gem](https://img.shields.io/gem/v/offline_geocoder) +![Gem](https://img.shields.io/gem/dt/offline_geocoder) + # OfflineGeocoder A gem for offline reverse geocoding. It uses data from the [GeoNames](http://www.geonames.org/) project. ## Installation @@ -20,25 +25,60 @@ ## Usage ```ruby require "offline_geocoder" - geocoder = OfflineGeocoder.new - results = geocoder.search(51.5214588, -0.1729636) - p results ``` The above code will output this: ```ruby {:lat=>51.51116, :lon=>-0.18426, :name=>"Bayswater", :admin1=>"England", :admin2=>"Greater London", :cc=>"GB", :country=>"United Kingdom"} ``` +Alternatively, you can use named parameters when searching: +```ruby +results = geocoder.search(lat: 51.5214588, lon: -0.1729636) +``` + +### Searching for names or attributes + +You can search for names, countries and such. The first result will be +returned. + +Searches are case sensitive and must match entirely. e.g. "York" will +not find "New York", and "Cote dIvoire" will not match "Cote d'Ivoire". + +```ruby +require "offline_geocoder" +geocoder = OfflineGeocoder.new +aus = geocoder.search(name: "Bayswater") +p aus +gb = geocoder.search(name: "Bayswater", country: "United Kingdom") +p gb +``` + +The above code will output this: + +```ruby +{:lat=>-37.85, :lon=>145.26667, :name=>"Bayswater", :admin1=>"Victoria", :admin2=>"Knox", :cc=>"AU", :country=>"Australia"} +{:lat=>51.51116, :lon=>-0.18426, :name=>"Bayswater", :admin1=>"England", :admin2=>"Greater London", :cc=>"GB", :country=>"United Kingdom"} +``` + ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). +To install this gem onto your local machine, run `bundle exec rake install`. + +## Contact Us + +For **questions** or **general comments** regarding the use of this library, please use our public +[hipchat room](http://inaka.net/hipchat). + +If you find any **bugs** or have a **problem** while using this library, please [open an issue](https://github.com/inaka/galgo/issues/new) in this repo (or a pull request :)). + +And you can check all of our open-source projects at [inaka.github.io](http://inaka.github.io)