alexreisner/geocoder — Issue #145: #within_bounding_box invalid if bounds cover 180th meridian
Author: hwuethrich
Created: 2011-12-01 11:11:11+00:00
State: open

The scope Geocoder::Store::ActiveRecord#within_bounding_box uses the following conditions if the bounding box covers the 180th meridian:

```
longitude BETWEEN #{sw_lng} AND 180 OR longitude BETWEEN #{ne_lng} and -180
```

Because ne_lng is always > -180, `BETWEEN #{ne_lng} and -180` never matches any results (at least with postgresql) and should be changed to:

```
longitude BETWEEN #{sw_lng} AND 180 OR longitude BETWEEN -180 AND #{ne_lng}
```

I'll fix this and send a pull request.