diff --git a/README_API_GUIDE.md b/README_API_GUIDE.md index 3896e5e02574d72179fa742a131f959e5129e9d3..26d5da82a18e3cf74148ffabe93cb59bf39cb065 100644 --- a/README_API_GUIDE.md +++ b/README_API_GUIDE.md @@ -170,17 +170,6 @@ The [Google Places Search API](https://developers.google.com/places/web-service/ * **Limitations**: ? * **Notes**: You can use the open (non-licensed) API by setting: `Geocoder.configure(mapquest: {open: true})` (defaults to licensed version) -### Ovi/Nokia (`:ovi`) - -* **API key**: not required, but performance restricted without it -* **Quota**: ? -* **Region**: world -* **SSL support**: no -* **Languages**: English -* **Documentation**: http://api.maps.ovi.com/devguide/overview.html -* **Terms of Service**: http://www.developer.nokia.com/Develop/Maps/TC.html -* **Limitations**: ? - ### Here/Nokia (`:here`) * **API key**: required (set `Geocoder.configure(api_key: [app_id, app_code])`) diff --git a/lib/geocoder/lookup.rb b/lib/geocoder/lookup.rb index 91482a918a55c86b02c5cf4383bcb9eba27841cd..baa85c9d2b4fc14e7d80d820bf154c02463cfde4 100644 --- a/lib/geocoder/lookup.rb +++ b/lib/geocoder/lookup.rb @@ -39,7 +39,6 @@ module Geocoder :mapquest, :mapzen, :opencagedata, - :ovi, :pelias, :pickpoint, :here, diff --git a/lib/geocoder/lookups/ovi.rb b/lib/geocoder/lookups/ovi.rb deleted file mode 100644 index 17ef6bd0e07d698378f48f73e148da6e716d8db8..0000000000000000000000000000000000000000 --- a/lib/geocoder/lookups/ovi.rb +++ /dev/null @@ -1,62 +0,0 @@ -require 'geocoder/lookups/base' -require 'geocoder/results/ovi' - -module Geocoder::Lookup - class Ovi < Base - - def name - "Ovi" - end - - def required_api_key_parts - [] - end - - def query_url(query) - "#{protocol}://lbs.ovi.com/search/6.2/#{if query.reverse_geocode? then 'reverse' end}geocode.json?" + url_query_string(query) - end - - private # --------------------------------------------------------------- - - def results(query) - return [] unless doc = fetch_data(query) - return [] unless doc['Response'] && doc['Response']['View'] - if r=doc['Response']['View'] - return [] if r.nil? || !r.is_a?(Array) || r.empty? - return r.first['Result'] - end - [] - end - - def query_url_params(query) - options = { - :gen=>1, - :app_id=>api_key, - :app_code=>api_code - } - - if query.reverse_geocode? - super.merge(options).merge( - :prox=>query.sanitized_text, - :mode=>:retrieveAddresses - ) - else - super.merge(options).merge( - :searchtext=>query.sanitized_text - ) - end - end - - def api_key - if a=configuration.api_key - return a.first if a.is_a?(Array) - end - end - - def api_code - if a=configuration.api_key - return a.last if a.is_a?(Array) - end - end - end -end diff --git a/lib/geocoder/results/ovi.rb b/lib/geocoder/results/ovi.rb deleted file mode 100644 index 552e2289c1d10b843d1e8098389a6d7f4ed9cb99..0000000000000000000000000000000000000000 --- a/lib/geocoder/results/ovi.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'geocoder/results/base' - -module Geocoder::Result - class Ovi < Base - - ## - # A string in the given format. - # - def address(format = :full) - address_data['Label'] - end - - ## - # A two-element array: [lat, lon]. - # - def coordinates - fail unless d = @data['Location']['DisplayPosition'] - [d['Latitude'].to_f, d['Longitude'].to_f] - end - - def state - address_data['County'] - end - - def province - address_data['County'] - end - - def postal_code - address_data['PostalCode'] - end - - def city - address_data['City'] - end - - def state_code - address_data['State'] - end - - def province_code - address_data['State'] - end - - def country - fail unless d = address_data['AdditionalData'] - if v = d.find{|ad| ad['key']=='CountryName'} - return v['value'] - end - end - - def country_code - 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 - @data['Location']['Address'] || fail - end - end -end diff --git a/test/fixtures/ovi_madison_square_garden b/test/fixtures/ovi_madison_square_garden deleted file mode 100644 index 464b8f851ef5795b68c6f543274c34de0e517ac7..0000000000000000000000000000000000000000 --- a/test/fixtures/ovi_madison_square_garden +++ /dev/null @@ -1,72 +0,0 @@ -{ - "Response": { - "MetaInfo": { - "Timestamp": "2013-02-08T16:26:39.382+0000" - }, - "View": [ - { - "_type": "SearchResultsViewType", - "ViewId": 0, - "Result": [ - { - "Relevance": 1.0, - "MatchLevel": "houseNumber", - "MatchQuality": { - "State": 1.0, - "City": 1.0, - "Street": [ - 1.0 - ], - "HouseNumber": 1.0 - }, - "MatchType": "pointAddress", - "Location": { - "LocationId": "NT_ArsGdYbpo6dqjPQel9gTID_4", - "LocationType": "point", - "DisplayPosition": { - "Latitude": 40.7504692, - "Longitude": -73.9933777 - }, - "NavigationPosition": [ - { - "Latitude": 40.7500305, - "Longitude": -73.9942398 - } - ], - "MapView": { - "TopLeft": { - "Latitude": 40.7515934, - "Longitude": -73.9948616 - }, - "BottomRight": { - "Latitude": 40.7493451, - "Longitude": -73.9918938 - } - }, - "Address": { - "Label": "4 Penn Plz, New York, NY 10001, United States", - "Country": "USA", - "State": "NY", - "County": "New York", - "City": "New York", - "Street": "Penn Plz", - "HouseNumber": "4", - "PostalCode": "10001", - "AdditionalData": [ - { - "value": "United States", - "key": "CountryName" - }, - { - "value": "New York", - "key": "StateName" - } - ] - } - } - } - ] - } - ] - } -} diff --git a/test/fixtures/ovi_no_results b/test/fixtures/ovi_no_results deleted file mode 100644 index 26fdaf93a8c450af5e6229de2ee34f5d1127a774..0000000000000000000000000000000000000000 --- a/test/fixtures/ovi_no_results +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Response": { - "MetaInfo": { - "Timestamp": "2013-02-08T16:41:16.723+0000" - }, - "View": [] - } -} diff --git a/test/unit/lookups/ovi_test.rb b/test/unit/lookups/ovi_test.rb deleted file mode 100644 index 1404ed3ea79b7a9a237af6ebc726acd1785fd8e2..0000000000000000000000000000000000000000 --- a/test/unit/lookups/ovi_test.rb +++ /dev/null @@ -1,17 +0,0 @@ -# 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