KVISH
KVISH

Reputation: 13178

Get nearest events for a user

In my application (iOS) i'm able to get the users current location. I also have a list of events in my database with the addresses and proper geocoding (latitude and longitude).

My question is, with the users current location and the addresses/geocodes in my database, how do I find the nearest events?

I'm using django and MySQL on my server side, and was not able to find any information regarding this... Can somebody point me in the right direction?

I did find these below links:

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCcQFjAA&url=http%3A%2F%2Fpropelorm.org%2Fblog%2F2012%2F08%2F13%2Fthe-behavior-tour-meet-the-geocodable-behavior.html&ei=zZthU_O2OqrisAS0-IL4CQ&usg=AFQjCNHIhMdzA8wXCQhHznENjM0IHZao6w&sig2=XEaaE-lATIORv8Pme-wPHg&bvm=bv.65636070,d.cWc&cad=rja

Upvotes: 1

Views: 97

Answers (1)

Alex
Alex

Reputation: 8539

GeoDjango docs on this are here and here. Basically just make a distance query and order by nearest.

I'd say take a first shot at it using those and come back if you have some code and a more specific issue.

Upvotes: 2

Related Questions