views:

5722

answers:

5

Hell All

I am developing the application that has two versions. One is for the Web, and one is for the iPhone.

In the web app, I am able to draw a route on the road (drawing the route automatically that follows roads/highways) and off road (draw direct line between two specific point).

On the iPhone is there an api that can be used to draw a route on the map? I am able to draw a straight line on map between two nodes, but am not able to draw a route. but i am not able to draw on road map in iPhone.

I am using iPhone 3.0 and SDK 3.0

Thanks.

+3  A: 

Unfortunately, there is no API for that in 3.0. You will probably have to add an overlay on the MKMapView, but that's probably very tedious

drvdijk
A: 

I answered a similar question which you can refer here

coffeemate
+1  A: 

A standard way on the iPhone (since there are restrictions expressed in the MapKit license) is to use [[[UIApplication sharedApplication] delegate] openURL:myURL]; to open up the Maps app.

myURL is a 'http://maps.google.com/maps?...' URL (NSURL object) with the subset of options supported in the docs on developer.apple.com. You use the saddr= and daddr= parameters to set the start and end address (or coordinates) of the route, and the user can then see the route and use the Maps app's driving, biking, or walking text directions to travel the route. Perhaps on iPhone 4 GM you will be able to return to your program, but currently opening the URL will terminate your app and start the Maps (or Safari, if Maps is not installed) app instead.

Henrik Erlandsson
+1  A: 

Thanks for the post, it covers almost features of MapKit like:

  1. Custom Annotation.
  2. Drawing route.
  3. Changing pin color.
Kapil Shivhare