@sources.push "osm_nominatim"
else
@sources.push "osm_nominatim"
- @sources.push "geonames"
- end
-
- render :update do |page|
- page.replace_html :sidebar_content, :partial => "search"
- page.call "openSidebar"
+ @sources.push "geonames" if defined?(GEONAMES_USERNAME)
end
end
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
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
@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|
@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
@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|