diff --git a/README.md b/README.md index 5dd78e2f9477c1c540d489b242ccb0ce4399fa88..c14037ab7c555fe020ecece08051026a3a5a8131 100644 --- a/README.md +++ b/README.md @@ -457,6 +457,17 @@ The [Google Places Details API](https://developers.google.com/places/documentati * **Terms of Service**: http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy * **Limitations**: Please limit request rate to 1 per second and include your contact information in User-Agent headers (eg: `Geocoder.configure(:http_headers => { "User-Agent" => "your contact info" })`). [Data licensed under Open Database License (ODbL) (you must provide attribution).](http://www.openstreetmap.org/copyright) +#### LocationIQ (`:locationiq`) + +* **API key**: required +* **Quota**: 6 request/second (30k req/day), then ability to purchase more +* **Region**: world +* **SSL support**: yes +* **Languages**: ? +* **Documentation**: http://locationiq.org/#docs +* **Terms of Service**: https://unwiredlabs.com/tos +* **Limitations**: [Data licensed under Open Database License (ODbL) (you must provide attribution).](http://www.openstreetmap.org/copyright) + #### OpenCageData (`:opencagedata`) * **API key**: required diff --git a/lib/geocoder/lookup.rb b/lib/geocoder/lookup.rb index fdc4a0705b09020079320b1e25fb3ffea3ffb3db..6cac49b1bbc8add5e523fbdb6276a6dbe531ff2b 100644 --- a/lib/geocoder/lookup.rb +++ b/lib/geocoder/lookup.rb @@ -23,6 +23,7 @@ module Geocoder # def street_services @street_services ||= [ + :locationiq, :dstk, :esri, :google, diff --git a/lib/geocoder/lookups/locationiq.rb b/lib/geocoder/lookups/locationiq.rb new file mode 100644 index 0000000000000000000000000000000000000000..7f14d214e5c14a9525aca0b20440195f840c96fc --- /dev/null +++ b/lib/geocoder/lookups/locationiq.rb @@ -0,0 +1,20 @@ +require 'geocoder/lookups/nominatim' +require "geocoder/results/locationiq" + +module Geocoder::Lookup + class Locationiq < Nominatim + def name + "Locationiq" + end + + def required_api_key_parts + ["api_key"] + end + + def query_url(query) + method = query.reverse_geocode? ? "reverse.php" : "search.php" + host = configuration[:host] || "locationiq.org/v1" + "#{protocol}://#{host}/#{method}?key=#{configuration.api_key}&" + url_query_string(query) + end + end +end diff --git a/lib/geocoder/results/locationiq.rb b/lib/geocoder/results/locationiq.rb new file mode 100644 index 0000000000000000000000000000000000000000..a06ea85ff06bf2852ec44940a008722b133947fd --- /dev/null +++ b/lib/geocoder/results/locationiq.rb @@ -0,0 +1,6 @@ +require 'geocoder/results/nominatim' + +module Geocoder::Result + class Locationiq < Nominatim + end +end \ No newline at end of file