Skip to content
Snippets Groups Projects
Commit 1d39ae5f authored by Alexander Logunov's avatar Alexander Logunov Committed by Alex Reisner
Browse files

add yandex bbox support (#1240)

parent d7cbe830
No related branches found
No related tags found
No related merge requests found
......@@ -47,12 +47,16 @@ module Geocoder::Lookup
else
q = query.sanitized_text
end
{
params = {
:geocode => q,
:format => "json",
:plng => "#{query.language || configuration.language}", # supports ru, uk, be
:key => configuration.api_key
}.merge(super)
}
unless (bounds = query.options[:bounds]).nil?
params[:bbox] = bounds.map{ |point| "%f,%f" % point }.join('~')
end
params.merge(super)
end
end
end
......@@ -19,4 +19,13 @@ class YandexTest < GeocoderTestCase
assert_equal "", result.country_code
assert_equal "", result.country
end
def test_yandex_query_url_contains_bbox
lookup = Geocoder::Lookup::Google.new
url = lookup.query_url(Geocoder::Query.new(
"Some Intersection",
:bounds => [[40.0, -120.0], [39.0, -121.0]]
))
assert_match(/bbox=40.0+%2C-120.0+%7E39.0+%2C-121.0+/, url)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment