tags:

views:

108

answers:

4

Hi all

I want to know how to display the route between two Points on map using mapkit framework in iphone

Is there any Api that can used to display the route between two Pins. If not Is Polyines is standard to show route between two pins.Can we display the route on Map with the help of polyines on iphone or is it dummy route between two points.

Thanks in advance

A: 

You could use Quartz to draw your lines.

  • Get the context of your map view
  • Move to the point of your first pin
  • Add a point to the point of your second pin
  • Configure your stroke (line-style, width, color)
  • Draw

A good tutorial about drawing with Quartz:

http://www.cocoadevcentral.com/d/intro_to_quartz_two/

weichsel
A: 

If you do this you will have your app rejected. You are not allowed to use the Google Map tiles (and thus MapKit) for routing.

You can use one of the open map frameworks, they may also support API's for drawing routes atop them. I would explore that before figuring out how to draw your own polylines.

Kendall Helmstetter Gelner
A: 

There's a nice sample on how to accomplish this with a custom MKAnnotationView here: http://spitzkoff.com/craig/?p=108

StephenT
A: 

You can find a working example at http://github.com/mobilemelting/nvpolyline This solution is especially targeted at iPhone OS versions prior to v.4.0

Although it can also be used in v.4.0 Hope this helps.

Colins