- # ask npemap.org.uk to do a combined npemap + freethepostcode search
- response = fetch_text("http://www.npemap.org.uk/cgi/geocoder.fcgi?format=text&postcode=#{escape_query(query)}")
+ if @results.empty?
+ @error = "Latitude or longitude are out of range"
+ render :action => "error"
+ else
+ render :action => "results"
+ end
+ else
+ # Coordinates in a query have come with markers for latitude and longitude.
+ if lat < -90 || lat > 90
+ @error = "Latitude #{lat} out of range"
+ render :action => "error"
+ elsif lon < -180 || lon > 180
+ @error = "Longitude #{lon} out of range"
+ render :action => "error"
+ else
+ @results = [{ :lat => lat, :lon => lon,
+ :zoom => params[:zoom],
+ :name => "#{lat}, #{lon}" }]