OK. Radius contains the radius, in miles, from the center of the Zipcode area.
In the following query, the latitudes and longitudes have been calculated to
yield a 20 X 20 mile square centered on the base Zipcode (in this case, 68504).
+-------+---------+----------+-----------+
| zip | city | latitude | longitude |
+-------+---------+----------+-----------+
| 68462 | WAVERLY | 40.9139 | 96.5270 |
| 68504 | LINCOLN | 40.8391 | 96.6565 |
+-------+---------+----------+-----------+
2 rows in set (0.09 sec)
DEBUG: query = SELECT * FROM zipcodes WHERE (latitude BETWEEN '40.694382199711'
AND
'40.983817800289') AND (longitude BETWEEN '96.547008929014' AND
'96.765991070986') ORDER BY state, county, city, zip ASC
68504: Radius: 10 Distance 0 miles
Waverly (68462) should have been selected in this query, but is not. As you
will
see by the following query (with radius set to 12 miles) Wavery is less than 9
miles from 68504.
DEBUG: query = SELECT * FROM zipcodes WHERE (latitude BETWEEN '40.665438639653'
AND
'41.012761360347') AND (longitude BETWEEN '96.525110714817' AND
'96.787889285183') ORDER BY state, county, city, zip ASC
68462: Radius: 12 Distance 8.5137543957707 miles
68504: Radius: 12 Distance 0 miles
NOTE: I have also tried :
DEBUG: query = SELECT * FROM zipcodes WHERE (latitude > 40.665438639653 AND
latitude < 41.012761360347) AND (longitude > 96.525110714817 AND longitude <
96.787889285183) ORDER BY state, county, city, zip ASC
With the same results.
NOTE: on advice from somone in #mysql, I tried altering the columns from float
to
decimal. Made no difference at all.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php