|
Posted by Pupkin on 11/30/06 20:05
Thanks, but I think I need the reverse of this. I don't have two points
from which to equate the distance. I have one point, from which I need
to be able to find all other points in the database within a, say, 50
mile radius.
I have no experience with cartography, but my gut feeling is this math
does something different than what I need. I'll poke around a little for
help on how to calculate differences in longitude and latitude.
Thanks.
>
> "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
>
>
>
Navigation:
[Reply to this message]
|