views:

72

answers:

1

I am new to using MapKit on iPhone.

On Google Maps, I have a current location and push pins to indicate nearest places around current location. (The co-ordinates of all are hard-coded as on now).

Now, How to do the following: 1. Display a green arrow (right/left arrow) pointing to the nearest push pin location from current location? 2. How to play a voice saying "Take right for 1 mile" etc to reach nearest location from current location?

A: 

I don't have a definite solution but some ideas which might help you.

  1. You can probably use a custom MKAnnotationView whose image will be the green arrow. You can then place this annotation (arrow) on top of your current location. Then you can find the closest pin (by checking its distance to the current location) and find the angle between the pin and the current location. With that angle you can rotate your arrow image so that it points towards the nearest pin.

  2. You can get the user's current location and heading and you can get the distance from the current location to the nearest pin. With this information you can figure out how far and in what direction the user needs to travel. I'm not sure if you want to synthesize the voice or if you have audio files ready. You'll probably have to play back short clips back to back (eg "take" + "right" + "for" + "1" + "mile"). Have a look at Apple's audio programming guide. As far as I know, you can't get street-specific directions in the current mapkit (eg. turn right on Main street).

Good luck.

Nebs
Yeah, I mean to synthesize the voice after deducing the distance. Any ideas are welcome.
You might have better luck if you create a separate question for the audio synthesis part since it's independent enough of the topic presented here. If someone's good with audio programming s/he may not necessarily check questions tagged MKMapView
Nebs