geocoder proximity within 1 mile

By 4cdg - September 16, 2011

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.

Re: [4cdg] geocoder proximity within 1 mile

By Jason - September 16, 2011

Hi,

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

If you could fill out a [url http://www.interactivetools.com/support]2nd Level Support Request[/url] we can take a closer look.

thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] geocoder proximity within 1 mile

By 4cdg - September 16, 2011

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 17K

Re: [4cdg] geocoder proximity within 1 mile

By Jason - September 19, 2011

Hi,

That's strange. If you could fill out a [url http://www.interactivetools.com/support]2nd Level Support Request[/url] we can take a look into this for you.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] geocoder proximity within 1 mile

By 4cdg - September 19, 2011

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

Re: [4cdg] geocoder proximity within 1 mile

By Jason - September 22, 2011

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 - Project Manager
interactivetools.com

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