Skip to content
Snippets Groups Projects
Commit dd65ed7a authored by Emil Sågfors's avatar Emil Sågfors
Browse files

Add viewport method for Ovi

parent 86b38251
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,15 @@ module Geocoder::Result
address_data['Country']
end
def viewport
map_view = data['Location']['MapView'] || fail
south = map_view['BottomRight']['Latitude']
west = map_view['TopLeft']['Longitude']
north = map_view['TopLeft']['Latitude']
east = map_view['BottomRight']['Longitude']
[south, west, north, east]
end
private # ----------------------------------------------------------------
def address_data
......
# encoding: utf-8
$: << File.join(File.dirname(__FILE__), "..", "..")
require 'test_helper'
class OviTest < GeocoderTestCase
def setup
Geocoder.configure(lookup: :ovi)
end
def test_ovi_viewport
result = Geocoder.search("Madison Square Garden, New York, NY").first
assert_equal [40.7493451, -73.9948616, 40.7515934, -73.9918938],
result.viewport
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