
Jason
Staff
/ Moderator

Sep 22, 2011, 1:01 PM
Post #7 of 7
(2459 views)
Shortcut
|
|
Re: [4cdg] geocoder proximity within 1 mile
[In reply to]
|
Can't Post
|
|
Hi, I took a look into this. The reason you cannot return anything within 1 mile is that, technically, you don't have any posts within 1 mile of your default zip code. The distance of your nearest zip code, in miles, is calculated as : 1.00949717326923, which the script interprets as being greater than 1, so it's disregarded. You can control the precision being used by using the MySQL TRUNCATE function. For example, if you want it to only look at the first two decimal places, you can alter the HAVING clause of your query like this: 'having' => "TRUNCATE(_distance, 2) <= " . $maxDist, // only show results within max distance If you don't want it to look at decimal places at all, you can use 0 like this: 'having' => "TRUNCATE(_distance, 0) <= " . $maxDist, // only show results within max distance Hope this helps --------------------------------------------------- Jason Sauchuk - Programmer interactivetools.com Hire me! Save time by getting our experts to help with your project. http://www.interactivetools.com/consulting/
|