Skip to content
Snippets Groups Projects
Commit 60ee62ed authored by Hannes Wüthrich's avatar Hannes Wüthrich
Browse files

Swap arguments for BETWEEN in #within_bounding_box

Fixes issue #145
parent 732895a8
No related branches found
No related tags found
No related merge requests found
...@@ -52,7 +52,7 @@ module Geocoder::Store ...@@ -52,7 +52,7 @@ module Geocoder::Store
return where(:id => false) unless sw_lat && sw_lng && ne_lat && ne_lng return where(:id => false) unless sw_lat && sw_lng && ne_lat && ne_lng
spans = "latitude BETWEEN #{sw_lat} AND #{ne_lat} AND " spans = "latitude BETWEEN #{sw_lat} AND #{ne_lat} AND "
spans << if sw_lng > ne_lng # Handle a box that spans 180 spans << if sw_lng > ne_lng # Handle a box that spans 180
"longitude BETWEEN #{sw_lng} AND 180 OR longitude BETWEEN #{ne_lng} and -180" "longitude BETWEEN #{sw_lng} AND 180 OR longitude BETWEEN -180 AND #{ne_lng}"
else else
"longitude BETWEEN #{sw_lng} AND #{ne_lng}" "longitude BETWEEN #{sw_lng} AND #{ne_lng}"
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment