]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/geocoder_controller.rb
Include the event type in the JSON output of a note
[rails.git] / app / controllers / geocoder_controller.rb
index d07b74f119d399e4c68e5b6a72fd7d6745c141ff..c55c85833b8f6a1a233ce31ea042e0e00303ac1d 100644 (file)
@@ -28,11 +28,6 @@ class GeocoderController < ApplicationController
       @sources.push "osm_nominatim"
       @sources.push "geonames"
     end
-
-    render :update do |page|
-      page.replace_html :sidebar_content, :partial => "search"
-      page.call "openSidebar"
-    end
   end
 
   def search_latlon
@@ -234,7 +229,7 @@ class GeocoderController < ApplicationController
     end
 
     # ask nominatim
-    response = fetch_xml("http://nominatim.openstreetmap.org/search?format=xml&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{request.user_preferred_languages.join(',')}")
+    response = fetch_xml("#{NOMINATIM_URL}search?format=xml&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{request.user_preferred_languages.join(',')}")
 
     # create result array
     @results = Array.new
@@ -264,9 +259,9 @@ class GeocoderController < ApplicationController
     end
 
     render :action => "results"
-  rescue Exception => ex
-    @error = "Error contacting nominatim.openstreetmap.org: #{ex.to_s}"
-    render :action => "error"
+#  rescue Exception => ex
+#    @error = "Error contacting nominatim.openstreetmap.org: #{ex.to_s}"
+#    render :action => "error"
   end
 
   def search_geonames
@@ -302,11 +297,6 @@ class GeocoderController < ApplicationController
 
     @sources.push({ :name => "osm_nominatim" })
     @sources.push({ :name => "geonames" })
-
-    render :update do |page|
-      page.replace_html :sidebar_content, :partial => "description"
-      page.call "openSidebar"
-    end
   end
 
   def description_osm_namefinder
@@ -355,7 +345,7 @@ class GeocoderController < ApplicationController
     @results = Array.new
 
     # ask OSM namefinder
-    response = fetch_xml("http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{request.user_preferred_languages.join(',')}")
+    response = fetch_xml("#{NOMINATIM_URL}reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{request.user_preferred_languages.join(',')}")
 
     # parse the response
     response.elements.each("reversegeocode/result") do |result|