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?
Asked
Active
Viewed 97 times
0
-
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 Answers
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.
-
I was going to search about calculating distance between two points :) Thanks – M.ahmed Mar 25 '15 at 17:26