I need to show directions
from current location
to another destination inside my app without opening Apple map app
. Is this possible to do with MapKit framework
? There are solutions for this using UIWebviews
, But I'm looking to do it usingmapview
.
Asked
Active
Viewed 1,109 times
0

Aman Aggarwal
- 3,754
- 1
- 19
- 26

Inoka
- 664
- 7
- 16
-
http://stackoverflow.com/questions/12883016/draw-a-path-between-two-coordinates-in-mapview-ios – Rushabh Feb 19 '13 at 10:03
-
You can draw the route using the overlays by calling the google api apple maps did not provide any api like google so the routes will be shown on apple maps as in google maps. By using overlays we ca achieve it. – 08442 Feb 19 '13 at 10:17
-
https://github.com/gimenete/iOS-boilerplate download this and in DirectionsExample.m and you can find url [NSString stringWithFormat:@"http://maps.google.com/maps?output=dragdir&saddr=%@&daddr=%@&hl=%@", saddr, daddr, [[NSLocale currentLocale] localeIdentifier]]; through this we can draw directions – 08442 Feb 19 '13 at 10:18
-
My question is whether it's possible to do using MapKit framework. I'm not interested to get the way points from the google api and draw in the mapview. – Inoka Feb 19 '13 at 10:24
-
have you downloaded that link example and tried – 08442 Feb 19 '13 at 10:38
-
@08442 No, But I show how it's looks like on Github page. If I wish to use Google API, I would be able to load a Google API URL on a UIWebview with current location and destination location as parameter to show that kind of view with direction. But I'm looking show it on the apple native mapview. So that I can use other features on it. – Inoka Feb 19 '13 at 10:51
-
@Inoka They are telling you to use native maps. You only need info about the route itself (as a list of points), and then you will be able to draw the route by using polylines on top. However, careful if you use the Google API together with Apple Maps because you will disregard Google's TOS. – Angel G. Olloqui Mar 11 '13 at 11:24
2 Answers
0
You can draw lines in map using MKPolyline. See this link
http://spitzkoff.com/craig/?p=136
https://github.com/kishikawakatsumi/MapKit-Route-Directions
These are all tutorials and open source libraries .

Rushabh
- 3,208
- 5
- 28
- 51
0
Use google map api to get the polyline from google by adding starting and stoping points latitude and longitude.this is the link for the api.
And this is the api url:
http://maps.googleapis.com/maps/api/directions/json?origin=starting_address&destination=destination_address&sensor=false
And for reference to create poly line see mapkit doc,and this project from github. nvpolyline,route-me,mapLines,MapKit-Route-Directions

Dilip Manek
- 9,095
- 5
- 44
- 56