Make sure we report "no results" when Nominatim's reverse geocoder fails

to find any results.
This commit is contained in:
Tom Hughes 2010-02-27 12:52:30 +00:00
parent 0b913efd05
commit e076d824bf

View 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(',')}") response = fetch_xml("http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{request.user_preferred_languages.join(',')}")
# parse the response # parse the response
response.elements.each("reversegeocode") do |result| response.elements.each("reversegeocode/result") do |result|
description = result.get_text("result").to_s description = result.get_text.to_s
@results.push({:prefix => "#{description}"}) @results.push({:prefix => "#{description}"})
end end