I am working on an app that would draw a "route" between two points on a lake that will be dynamically selected from annotations on the map. I've looked to see if anyone has tried to do this, and I haven't found an answer to this question. If you can help that would be great.
Asked
Active
Viewed 423 times
0
-
It is a pretty basic situation where you have an array of cllotations and you draw a line joining these locations. Check other question regarding MKPolyline and MKPolyLineView. – Cyril Godefroy May 26 '12 at 13:09
-
Except that they are dynamic annotations on a map and I want to get the distance and heading between those two points. I know it's probably something simple. Thanks. – Stan Cromlish May 26 '12 at 14:39
-
An MKAnnotation has a set of coordinates. Create CLLocations based on these coordinates, rinse, repeat. Getting the distance will be as easy as distanceFromLocation: and for heading you need to do a little bit of trigonometry (not strictly related to map kit). – Cyril Godefroy May 26 '12 at 16:07
-
Being new to ipad and iphone development, I'm confused on distanceFromLocation. If you could give me a code sample that would be great. Thanks. – Stan Cromlish May 27 '12 at 22:33