- if lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180
- @results.push(:lat => lat, :lon => lon,
- :zoom => params[:zoom],
- :name => "#{lat}, #{lon}")
- end
- if lon >= -90 && lon <= 90 && lat >= -180 && lat <= 180
- @results.push(:lat => lon, :lon => lat,
- :zoom => params[:zoom],
- :name => "#{lon}, #{lat}")
- end
+ if params[:latlon_digits]
+ # We've got two nondescript numbers for a query, which can mean both "lat, lon" or "lon, lat".
+ @results = []
+
+ if lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180
+ @results.push(:lat => lat, :lon => lon,
+ :zoom => params[:zoom],
+ :name => "#{lat}, #{lon}")
+ end
+
+ if lon >= -90 && lon <= 90 && lat >= -180 && lat <= 180
+ @results.push(:lat => lon, :lon => lat,
+ :zoom => params[:zoom],
+ :name => "#{lon}, #{lat}")
+ end