0

I want to add Compass to my Map to get the people around me, like if I faced to North then I can only see those people who are in North and next to me, see in image I'm on a Map view at particular location and yellow and red ovals are other person around me.

So what I want that if I faced in the direction where Red ovals then I can only get list of Red ovals not yellow. I don't have any idea to implement this.

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Eager Beaver
  • 949
  • 3
  • 11
  • 20

1 Answers1

1

1) Calculate the bearing between two lat,lon coordinates (your location and the other user location). (simple search here)
2) Then calculate the delta angle between your compass heading, and the bearing from 1)

then if abs(deltaAngle) < 60 take that user.

AlexWien
  • 28,470
  • 6
  • 53
  • 83