]> git.openstreetmap.org Git - rails.git/commitdiff
Allow the Nominatim instance used to be configured
authorTom Hughes <tom@compton.nu>
Tue, 2 Nov 2010 10:40:43 +0000 (10:40 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 2 Nov 2010 10:40:43 +0000 (10:40 +0000)
app/controllers/geocoder_controller.rb
config/example.application.yml

index d07b74f119d399e4c68e5b6a72fd7d6745c141ff..29e7648afed5878eecbcdc05bb43a2d2b869e47c 100644 (file)
@@ -234,7 +234,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
@@ -355,7 +355,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|
index 9b00beb58de2fccc8ef964fa25d1a9ead65dbe7b..ab5c9a846be2e7e7615fb1b1f8907c68308cd863 100644 (file)
@@ -55,6 +55,8 @@ standard_settings: &standard_settings
   #file_column_root: ""
   # Enable legacy OAuth 1.0 support
   oauth_10_support: true
+  # URL of Nominatim instance to use for geocoding
+  nominatim_url: "http://nominatim.openstreetmap.org/"
 
 development:
   <<: *standard_settings