X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/33790824d6b32d103e0dc69bf6877373266744fe..77e8a16a153752b919a9153c1c9ded9834d387f7:/app/controllers/geocoder_controller.rb?ds=inline diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index 5a59c9eeb..a4e1ded86 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -185,9 +185,9 @@ class GeocoderController < ApplicationController end render :action => "results" - # rescue StandardError => ex - # @error = "Error contacting nominatim.openstreetmap.org: #{ex.to_s}" - # render :action => "error" + rescue StandardError => ex + @error = "Error contacting nominatim.openstreetmap.org: #{ex}" + render :action => "error" end def search_geonames @@ -217,7 +217,7 @@ class GeocoderController < ApplicationController render :action => "results" rescue StandardError => ex - @error = "Error contacting ws.geonames.org: #{ex}" + @error = "Error contacting api.geonames.org: #{ex}" render :action => "error" end @@ -279,7 +279,7 @@ class GeocoderController < ApplicationController render :action => "results" rescue StandardError => ex - @error = "Error contacting ws.geonames.org: #{ex}" + @error = "Error contacting api.geonames.org: #{ex}" render :action => "error" end @@ -293,35 +293,6 @@ class GeocoderController < ApplicationController REXML::Document.new(fetch_text(url)) end - def format_distance(distance) - t("geocoder.distance", :count => distance) - end - - def format_direction(bearing) - return t("geocoder.direction.south_west") if bearing >= 22.5 && bearing < 67.5 - return t("geocoder.direction.south") if bearing >= 67.5 && bearing < 112.5 - return t("geocoder.direction.south_east") if bearing >= 112.5 && bearing < 157.5 - return t("geocoder.direction.east") if bearing >= 157.5 && bearing < 202.5 - return t("geocoder.direction.north_east") if bearing >= 202.5 && bearing < 247.5 - return t("geocoder.direction.north") if bearing >= 247.5 && bearing < 292.5 - return t("geocoder.direction.north_west") if bearing >= 292.5 && bearing < 337.5 - t("geocoder.direction.west") - end - - def format_name(name) - name.gsub(/( *\[[^\]]*\])*$/, "") - end - - def count_results(results) - count = 0 - - results.each do |source| - count += source[:results].length if source[:results] - end - - count - end - def escape_query(query) URI.escape(query, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]", false, "N")) end