Friday, 11 March 2011

iphone google maps - direction using latitude and longitude

NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f",currentLocation.coordinate.latitude,currentLocation.coordinate.longitude,
destLocation.coordinate.latitude, destLocation.coordinate.longitude];

[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];


2 comments:

  1. Dear Sir,
    I want to get latitude and longitude from php side and show current location.

    ReplyDelete
  2. In iphone Google Map is already a default functionality to show current location

    if you want to show it to webpage then

    Create a URI like this one:

    http://maps.google.com/?q=[lat],[long]

    ReplyDelete