Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder: Plugins & Add-ons:
geocoder proximity within 1 mile

 

 


4cdg
User

Sep 16, 2011, 7:01 AM

Post #1 of 7 (2604 views)
Shortcut
geocoder proximity within 1 mile Can't Post

When I try to do a proximity search and setup a distance within 1 mile i get no results. I am pulling this data into the multi map also and it says no map available.

Is this unable to do a search within 1 mile?

here is what I put as the option in the form <option value="1" <?php selectedIf( 1, @$_REQUEST['maxDistance']) ?> >within 1 mile</option>

This is on a real estate website and the users would really like to be able to see listings within 1 mile of address or zip.


Jason
Staff / Moderator


Sep 16, 2011, 10:01 AM

Post #2 of 7 (2602 views)
Shortcut
Re: [4cdg] geocoder proximity within 1 mile [In reply to] Can't Post

Hi,

Do you get results properly when searching for distances other than 1 mile?

If you could fill out a 2nd Level Support Request we can take a closer look.

thanks
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/ 


4cdg
User

Sep 16, 2011, 10:17 AM

Post #3 of 7 (2601 views)
Shortcut
Re: [Jason] geocoder proximity within 1 mile [In reply to] Can't Post

Yes, 2 miles works.

I just combined the examples of proximity search and multi map display and everything works perfect except when trying to do distance within 1 mile.

the url is www.stoddardmls.com/proximity.php and i have attached the file
Attachments: proximity.php (16.6 KB)


Jason
Staff / Moderator


Sep 19, 2011, 10:11 AM

Post #4 of 7 (2574 views)
Shortcut
Re: [4cdg] geocoder proximity within 1 mile [In reply to] Can't Post

Hi,

That's strange. If you could fill out a 2nd Level Support Request we can take a look into this for you.

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/ 


4cdg
User

Sep 19, 2011, 11:58 AM

Post #5 of 7 (2572 views)
Shortcut
Re: [Jason] geocoder proximity within 1 mile [In reply to] Can't Post

Ok, I have narrowed this down to so within 1 mile will work for address + city, state and just city, state and address + zip code but if you just enter a zip code into the search it gives you no map available for results within 1 mile.

http://www.stoddardmls.com/proximity.php


Jason
Staff / Moderator


Sep 20, 2011, 10:31 AM

Post #6 of 7 (2541 views)
Shortcut
Re: [4cdg] geocoder proximity within 1 mile [In reply to] Can't Post

Hi,

In order to be able to try to find the root cause of this issue, we'll need to be able to see the script running and run some tests. So we'll need to have access to the server/ installation. If you could fill out a 2nd Level Support Request we can take a closer look.

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/ 


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/