0

If I have the latitude and longitude of my location how can I find other users using my app at a certain distance say 5 km from my location?

What I am trying to implement is that if a user sends a request, it goes to the people using the app at a range of supposing x km from the user.

Please suggest methods to accomplish this, approach,libraries and so on.

Mohit Shah
  • 843
  • 1
  • 6
  • 20
  • There is a similarity case, please see [How to get distance between two locations in Windows Phone 8.1](http://stackoverflow.com/questions/28569246/how-to-get-distance-between-two-locations-in-windows-phone-8-1). – Jayden Apr 08 '16 at 05:50
  • I already know haversine formula but that is not my question – Mohit Shah Apr 08 '16 at 05:51
  • What approach should I use to find users using my app in proximity – Mohit Shah Apr 08 '16 at 05:52
  • It seems you can run a background and get the distance from your location to the user's location when the user's location has changed. Please see this case,[Location tracking when app is in background in Windows 10?](http://stackoverflow.com/questions/36307963/location-tracking-when-app-is-in-background-in-windows-10#comment60268228_36307963). – Jayden Apr 08 '16 at 06:01
  • Ok so now I have other users locations being reported to servers and also I know how to find distance between two coordinates but direct comparsion between my coordinates and coordinates of each of those users who may number in hundreds of thousands is an inefficient approach. Can you tell me how to make this approach efficient – Mohit Shah Apr 08 '16 at 06:04
  • For example I should not need to find distance between users who are hundreds of km away from me. This is unnecessary computation – Mohit Shah Apr 08 '16 at 06:05
  • The server get the all of the location from the users, then the server can order all of the locations from the top to the small. So if the location is (47.643,-122.131), and you want get the all the users that between user distance less than 5km, you can get the location from (47.643±0.002,-122.131±0.002). It is just for example, the number is not right. – Jayden Apr 08 '16 at 06:30
  • Can you point me to a link where they show how this calculation is done like 5 km away from the user finding the max latitude and longitude – Mohit Shah Apr 08 '16 at 06:37
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/108590/discussion-between-jayden-gu-and-mohit). – Jayden Apr 08 '16 at 06:47

0 Answers0