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 d07b74f..29e7648 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 9b00beb..ab5c9a8 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