]> git.openstreetmap.org Git - rails.git/commitdiff
Make sure we report "no results" when Nominatim's reverse geocoder fails
authorTom Hughes <tom@compton.nu>
Sat, 27 Feb 2010 12:52:30 +0000 (12:52 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 27 Feb 2010 12:52:30 +0000 (12:52 +0000)
to find any results.

app/controllers/geocoder_controller.rb

index 8394b3e6e0c9f70b5c124daff923a1970cccc36c..aaa8d17ef114524cff62490b5db150279dee5d6c 100644 (file)
@@ -357,8 +357,8 @@ class GeocoderController < ApplicationController
     response = fetch_xml("http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{request.user_preferred_languages.join(',')}")
 
     # parse the response
     response = fetch_xml("http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{request.user_preferred_languages.join(',')}")
 
     # parse the response
-    response.elements.each("reversegeocode") do |result|
-      description = result.get_text("result").to_s
+    response.elements.each("reversegeocode/result") do |result|
+      description = result.get_text.to_s
 
       @results.push({:prefix => "#{description}"})
     end
 
       @results.push({:prefix => "#{description}"})
     end