PDA

View Full Version : "Find Nearest Location"




swb1192
Jan 3, 2009, 10:30 PM
I have a bunch of locations (of chapels across the US) and I need to make it so the user can "find the nearest location" of a chapel. I'm not sure how I should go about doing this. The website uses Joomla (I'm not the one who thought of using it... I hate it!), so if there are any extensions you know of that would let me do that I would appreciate it. If there are any other ways of doing it, I'll take those too. Little to no cost would be great, too.



angelwatt
Jan 3, 2009, 11:20 PM
You can make use of a PHP class like this one,
http://www.micahcarrick.com/04-19-2005/php-zip-code-range-and-distance-calculation.html

cr2sh
Jan 3, 2009, 11:45 PM
You could use the google maps geocode function, pass the addresses and get a latitude and longitude for each address.... then compute the hypotenuse of the differences and select the lowest value of the set... that would be your closest chapel. Across a small enough area polar coordinates can be used to approximate a rectangular coordinate system.

http://code.google.com/apis/maps/documentation/services.html#Geocoding

Check out my awesome graphic:

swb1192
Jan 4, 2009, 12:15 AM
You could use the google maps geocode function, pass the addresses and get a latitude and longitude for each address.... then compute the hypotenuse of the differences and select the lowest value of the set... that would be your closest chapel. Across a small enough area polar coordinates can be used to approximate a rectangular coordinate system.

http://code.google.com/apis/maps/documentation/services.html#Geocoding

Check out my awesome graphic:

This will take some learning, but I'll see what I can do. I'll probably try angelwatt's idea first.

Thanks for the great graphic :)