0

I am using MKMapView and showing particular point on that map.

There is a button in my screen for finding My Location.now i want that when i click on MyLocation button both the point(My location and another point for particular location) should come in single screen .
****it should be like like : ****

------------------------------ enter image description here

so i have to calculate distance between myLocation (blue) and particular point (Red)

Any help please ?

PJR
  • 12,746
  • 12
  • 60
  • 101
  • 1
    http://stackoverflow.com/questions/1336370/positioning-mkmapview-to-show-multiple-annotations-at-once – DanZimm Nov 24 '11 at 07:08

2 Answers2

0

If you want to show Direction in google maps you need current latitude & longitude and particular place lat & long,

Within Button touch action

 {          
  NSURL *strlist = [NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f",c_lat,c_long,lat,long]];
       here //c_lat = current latitude
  //c_long = current longitude
  //lat = Particular place latitude
  //long = Particular place longitude
 [[UIApplication sharedApplication]openURL:strlist];   
 }

If you want to show direction map within app,

Refer this tut

Link for Direction Tut

Ankit Chauhan
  • 2,255
  • 6
  • 24
  • 36
0

Something Similar ...

    //create new region and set map
    CLLocationCoordinate2D coord = {latitude: yourLocation.latitude, longitude: yourLocation.longitude};
     MKCoordinateSpan span = MKCoordinateSpanMake(fabs(otherLocation.lattitude), fabs(otherLocation.longitude));
    MKCoordinateRegion region = {coord, span};
    [self.mapView setRegion:region];
Mihir Mehta
  • 13,424
  • 2
  • 59
  • 85