Hello,

On 01/21/2004 08:22 PM, Ray wrote:
we import a database that has among other things, listings of locations by address, city, county and zip, and our customers would like their website to have a 'within $x miles of $address $city $zip' search in addition to the other searching they already have. another customer would like to have a click on the map to do a search of within 25 miles of where on the map they clicked on the same database. anyone have any pointers, tips or links on how to do either of these searches?

the database changes frequently (nearly daily updates from a 3rd party that currently is having problems filling in all the fields they said they would give us) and contains over 10000 records, so it wouldn't be practical to add information to the records manually to facilitate a location/distance based search. we do add some additional fields automaticly, so it won't be a huge problem/rewrite to add additional columns in an automated fashion.

You may want to look at this class as it lets you not only determine the approximate coordinates (latitute and longitude) of any server given its domain name or IP and from then on you can also use a function of that class that calculates the geographic distance between any two points in the globe given their coordinates.


http://www.phpclasses.org/netgeoclass

A demonstration of that class in action can been seen in this page where the site lists all the mirrors available sorted by geographic distance from the user network. It may not work in all cases due to the continuos reallocations of Internet IP ranges but it often works well:

http://www.phpclasses.org/mirrors.html?closest=1

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to