/    Sign up×
Community /Pin to ProfileBookmark

Find items in database where location is <= 10 miles from query_location

I have been asked to put together a quote for a MySQL based site that lets customers register their pets. If one customer reports their pet missing, an email needs to be sent to all customers within 10 miles of the missing pet’s home. I guess I’ll have to find an app that converts addresses to lon/lat and do Great Circle computations, but I don’t know what I should do in MySQL and what I should do in PHP.

I’m sure this problem has been solved before, but I don’t know where to look for it. ?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@AravonaJun 15.2010 — You could use post code / zip code? instead of lon/lat
Copy linkTweet thisAlerts:
@TecBratauthorJun 18.2010 — If it was my own site I'd do a zipcode search, but the customer asked for a radius search.

Anyone tackled this already and can point me in the right direction?
Copy linkTweet thisAlerts:
@ryanlundJun 18.2010 — Ok here is how ive done this. I've use the google local search api (rewrote into PHP) to find the latitude and longitude of a postcode/zip/whatever. Then if you dont know how to work out the distances based on latitude and longitude values theres plenty of information on the internet to help you. Write it up into SQL and your sorted. =) Gimme a PM if you need any help.
×

Success!

Help @TecBrat spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...