X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0f28e0581ec2076faabb79f1071bf157c0e68dcc..79d3ee46545f1a5b60d40bfe8a803974a97d0a09:/app/controllers/geocoder_controller.rb diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index 79da2f6e9..18812689b 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -29,7 +29,7 @@ class GeocoderController < ApplicationController if results_count == 1 position = results.collect { |s| s[:results] }.compact.flatten[0] - page.call "setPosition", position[:lat], position[:lon], position[:zoom] + page.call "setPosition", position[:lat].to_f, position[:lon].to_f, position[:zoom].to_i else page.call "openSidebar" end @@ -102,7 +102,7 @@ private response = fetch_xml("http://geocoder.ca/?geoit=XML&postal=#{escape_query(query)}") # parse the response - unless response.get_elements("geodata/error") + if response.get_elements("geodata/error").empty? results.push({:lat => response.get_text("geodata/latt").to_s, :lon => response.get_text("geodata/longt").to_s, :zoom => POSTCODE_ZOOM,