|  | Posted by Steve on 11/29/06 04:57 
"Pupkin" <spamagnet@dorrk.com> wrote in message news:MPG.1fd6204510852de598978a@news.giganews.com...
 | Hey,
 |
 | Anyone know of a good PHP-based store/dealer locator app that can handle
 | international locations?
 |
 | We have a hand-built app from a previous programmer, but the thing is
 | always breaking (Javascript errors, stores not showing up inside their
 | own zip code).
 |
 | We'd like the user to be able to type in an address or zip code and be
 | shown a list of dealers within a certain radius. Integration with Google
 | maps would be ideal.
 |
 | I've found a few on Hotscripts, but most are US-centric. If anyone knows
 | of a tried and trusted app, links are welcome!
 |
 | Thanks.
 
 btw, i had saved this calculation some time ago. NC posted it here. this
 formula will take long/lat and give you distance between two points. (acos,
 cos, and sin are supported functions in most db's...i'd do it in a query
 where it uses your lat/long points as input and and the criteria is where
 distance is <= your max desired distance from any given store.
 
 hth...and thanks to NC for the math. ;^)
 
 $distance = $r *
 acos(
 cos($lat1) *
 cos($lon1) *
 cos($lat2) *
 cos($lon2) +
 cos($lat1) *
 sin($lon1) *
 cos($lat2) *
 sin($lon2) +
 sin($lat1) *
 sin($lat2)
 );
 
 where:
 
 $r    -- radius of the Earth
 $lat1 -- latitude of point 1 in radians
 $lon1 -- longitude of point 1 in radians
 $lat2 -- latitude of point 2 in radians
 $lon2 -- longitude of point 2 in radians
 [Back to original message] |