]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/geocoder_controller.rb
Show the correct reconfirm link for OpenID login attempts
[rails.git] / app / controllers / geocoder_controller.rb
index c55c85833b8f6a1a233ce31ea042e0e00303ac1d..2b03790aacdbdb87ece90fc88833d22c296b060e 100644 (file)
@@ -26,7 +26,7 @@ class GeocoderController < ApplicationController
       @sources.push "osm_nominatim"
     else
       @sources.push "osm_nominatim"
-      @sources.push "geonames"
+      @sources.push "geonames" if defined?(GEONAMES_USERNAME)
     end
   end
 
@@ -272,7 +272,7 @@ class GeocoderController < ApplicationController
     @results = Array.new
 
     # ask geonames.org
-    response = fetch_xml("http://ws.geonames.org/search?q=#{escape_query(query)}&maxRows=20")
+    response = fetch_xml("http://api.geonames.org/search?q=#{escape_query(query)}&maxRows=20&username=#{GEONAMES_USERNAME}")
 
     # parse the response
     response.elements.each("geonames/geoname") do |geoname|