README.md in geocoder-1.2.12 vs README.md in geocoder-1.2.13

- old
+ new

@@ -7,11 +7,11 @@ Compatibility ------------- -* Supports multiple Ruby versions: Ruby 1.9.3, 2.0.x, 2.1.x, JRuby, and Rubinius. +* Supports multiple Ruby versions: Ruby 1.9.3, 2.x, JRuby, and Rubinius. * Supports multiple databases: MySQL, PostgreSQL, SQLite, and MongoDB (1.7.0 and higher). * Supports Rails 3 and 4. If you need to use it with Rails 2 please see the `rails2` branch (no longer maintained, limited feature set). * Works very well outside of Rails, you just need to install either the `json` (for MRI) or `json_pure` (for JRuby) gem. @@ -104,10 +104,14 @@ If you have just added geocoding to an existing application with a lot of objects you can use this Rake task to geocode them all: rake geocode:all CLASS=YourModel +If you need reverse geocoding instead, call the task with REVERSE=true: + + rake geocode:all CLASS=YourModel REVERSE=true + Geocoder will print warnings if you exceed the rate limit for your geocoding service. Some services — Google notably — enforce a per-second limit in addition to a per-day limit. To avoid exceeding the per-second limit, you can add a `SLEEP` option to pause between requests for a given amount of time. You can also load objects in batches to save memory, for example: rake geocode:all CLASS=YourModel SLEEP=0.25 BATCH=100 ### Avoiding Unnecessary API Requests @@ -138,19 +142,29 @@ Location-Aware Database Queries ------------------------------- +### For Mongo-backed models: + +Please use MongoDB's [geospatial query language](https://docs.mongodb.org/manual/reference/command/geoNear/). Mongoid also provides [a DSL](http://mongoid.github.io/en/mongoid/docs/querying.html#geo_near) for doing near queries. + +### For ActiveRecord models: + To find objects by location, use the following scopes: Venue.near('Omaha, NE, US', 20) # venues within 20 miles of Omaha Venue.near([40.71, -100.23], 20) # venues within 20 miles of a point Venue.near([40.71, -100.23], 20, :units => :km) # venues within 20 kilometres of a point Venue.geocoded # venues with coordinates Venue.not_geocoded # venues without coordinates +by default, objects are ordered by distance. To remove the ORDER BY clause use the following: + + Venue.near('Omaha', 20, :order => false) + With geocoded objects you can do things like this: if obj.geocoded? obj.nearbys(30) # other objects within 30 miles obj.distance_from([40.714,-100.234]) # distance from arbitrary point to object @@ -498,10 +512,24 @@ * **Languages**: English * **Documentation**: http://geocoder.us/help/ * **Terms of Service**: http://geocoder.us/terms.shtml * **Limitations**: ? +#### Mapbox (`:mapbox`) + +* **API key**: required +* **Dataset**: Uses `mapbox.places` dataset by default. Specific the `mapbox.places-permanent` dataset by setting: `Geocoder.configure(:mapbox => {:dataset => "mapbox.places-permanent"})` +* **Key signup**: https://www.mapbox.com/pricing/ +* **Quota**: depends on plan +* **Region**: complete coverage of US and Canada, partial coverage elsewhere (see for details: https://www.mapbox.com/developers/api/geocoding/#coverage) +* **SSL support**: yes +* **Languages**: English +* **Documentation**: https://www.mapbox.com/developers/api/geocoding/ +* **Terms of Service**: https://www.mapbox.com/tos/ +* **Limitations**: For `mapbox.places` dataset, must be displayed on a Mapbox map; Cache results for up to 30 days. For `mapbox.places-permanent` dataset, depends on plan. +* **Notes**: Currently in public beta. + #### Mapquest (`:mapquest`) * **API key**: required * **Key signup**: https://developer.mapquest.com/plans * **Quota**: ? @@ -651,17 +679,18 @@ * **Limitations**: ? * **Notes**: To use Pointpin set `Geocoder.configure(:ip_lookup => :pointpin, :api_key => "your_pointpin_api_key")`. #### Telize (`:telize`) -* **API key**: none -* **Quota**: none +* **API key**: required +* **Quota**: 1,000/day for $7/mo through 100,000/day for $100/mo * **Region**: world -* **SSL support**: no +* **SSL support**: yes * **Languages**: English -* **Documentation**: http://www.telize.com/ +* **Documentation**: https://market.mashape.com/fcambus/telize * **Terms of Service**: ? * **Limitations**: ? +* **Notes**: To use Telize set `Geocoder.configure(:ip_lookup => :telize, :api_key => "your_api_key")`. #### MaxMind Legacy Web Services (`:maxmind`) * **API key**: required * **Quota**: Request Packs can be purchased