So I’m working on a mobile app for a client that basically displays all the restaurants/bars/etc in a given city. One of the main components of the app is to be able to use the location (lng, lat) on your phone to see which restaurants are nearby. I have a feed going that basically shows all the restaurants (in my collection) and I’d like to give the user the ability to sort by the following (at least the ones I need help with):
- nearest location (i.e. which bar/restaurant is closest to you)
- in a particular city (all the bars in “Xcity”)
My issue is not bug related, more of how to build out the “sort” component, if that makes sense. To grab the phones location I’m using the lovely
Geolocation.latLng(), and I’m storing the bar/restaurant location using
aldeed:geocoder (to convert the address supplied to lng/lat).
Now that I’ve laid everything out, I’m looking to at least get some direction on how to go about sorting a MiniMongo Collection by it’s location based on which is closest to my phones location. I feel like there’s an API or some easy package out that I’m missing, given how much this functionality has been performed. Any ideas are appreciated guys. Thanks