0

First, Thanks in advance :) I'm working on a native iOS App. I've an array of points (lats&longs) and I need when user scroll in the mapview, Detect the nearby points (points from array) from the current scrolling position. Are there any tutorials or examples regarding this?

M.ahmed
  • 7
  • 2
  • Iterate over the array and compute the distance to all possible points. If this distance is within a certain limit ('nearby'), then do something with that point. – luk2302 Mar 25 '15 at 17:14
  • Yes this is a good solution, Many thanks @luk2302 – M.ahmed Mar 25 '15 at 17:19

1 Answers1

0

To clarify my comment:

Iterate over the array and calculate the distance between the array element and the current MKMapView point. If the calculated distance is smaller than a certain bound ('nearby' -> e.g. 5000 meters), then do something with that point, e.g. log it or load more data, etc...

For calculating the distance between two long/lat points look at GPS coordinates in degrees to calculate distances, since they are not 2D points in the conventional sense.

Community
  • 1
  • 1
luk2302
  • 55,258
  • 23
  • 97
  • 137