I have a query like so:
SELECT * FROM chat_rooms
WHERE earth_box(ll_to_earth(5, 5), 111000) @> ll_to_earth(lat, lng);
Essentially, I have lat = lng = 5
in the query, and in my chat_rooms
table I have two entries, one with lat=lng=5
, the other with lat=lng=4
. Using an online calculator, the distance between these two entries is 157 miles = 252.667km (i.e. entry lat=lng=4
should be returned when radius >= 157 miles. However, the query only returns the entry with lat=lng=4
when the radius is specified as ~111,000+. My question is, what unit is the radius in, and am I conducting this query correctly?