I am using UIMapView to display locations on the iPhone. I want to do a directions from current location to the location of interest, I don't think its possible using MapKit (but if it is please inform) So I will open either the Google Maps application or safari to display it.
Can i do this by specifying co-ordinates from (current location) to co-ordinates (the location of interest) I have these longitudes and latitudes. Or do i have to use street addresses?
If I do have to use street addresses, can i get them from the latitude and longitude.
Yeah, it's not possible using MapKit. You could try to form a Google maps url request that contains both your current location and destination that will open in the Google maps app with the directions.
Here's an example url:
http://maps.google.com/?saddr=34.052222,-118.243611&daddr=37.322778,-122.031944
Here's how you could implement this in your code:
CLLocationCoordinate2D start = { 34.052222, -118.243611 };
CLLocationCoordinate2D destination = { 37.322778, -122.031944 };
NSString *googleMapsURLString = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f",
start.latitude, start.longitude, destination.latitude, destination.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapsURLString]];