]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/geocoder_controller.rb
fix id/relid inconsistency
[rails.git] / app / controllers / geocoder_controller.rb
index 79da2f6e9a2d52bb451e4840557eab0736287bec..18812689b4c2c8318d792993e6366987bdde479a 100644 (file)
@@ -29,7 +29,7 @@ class GeocoderController < ApplicationController
 
       if results_count == 1
         position = results.collect { |s| s[:results] }.compact.flatten[0]
 
       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
       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
     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,
       results.push({:lat => response.get_text("geodata/latt").to_s,
                     :lon => response.get_text("geodata/longt").to_s,
                     :zoom => POSTCODE_ZOOM,