+ def search_latlon(query)
+ results = Array.new
+
+ # decode the location
+ if m = query.match(/^([+-]?\d+(\.\d*)?)\s*[\s,]\s*([+-]?\d+(\.\d*)?)$/)
+ lat = m[1].to_f
+ lon = m[3].to_f
+ end
+
+ # generate results
+ if lat < -90 or lat > 90
+ return { :source => "Internal", :url => "http://openstreetmap.org/", :error => "Latitude #{lat} out of range" }
+ elsif lon < -180 or lon > 180
+ return { :source => "Internal", :url => "http://openstreetmap.org/", :error => "Longitude #{lon} out of range" }
+ else
+ results.push({:lat => lat, :lon => lon,
+ :zoom => APP_CONFIG['postcode_zoom'],
+ :name => "#{lat}, #{lon}"})
+
+ return { :source => "Internal", :url => "http://openstreetmap.org/", :results => results }
+ end
+ end
+