2 def self.describe_location(lat, lon, zoom = nil, language = nil)
4 language = language || request.user_preferred_languages.join(',')
6 Rails.cache.fetch "/nominatim/location/#{lat}/#{lon}/#{zoom}/#{language}" do
7 url = "http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{language}"
10 response = OSM::Timer.timeout(4) do
11 REXML::Document.new(Net::HTTP.get(URI.parse(url)))
17 if response and result = response.get_text("reversegeocode/result")
20 "#{number_with_precision(lat, :precision => 3)}, #{number_with_precision(lon, :precision => 3)}"