0

Hi, i am working on GPS ios app.

I want to display user's location on Circle as shown in image.

The user is in center.

I want to display his friend's location on proper direction.

I had already got langitude and latitude of both user .

But how can i get other user's direction?

If can i use Bearing angle?

enter image description here

I get the Distance between two uses by this code

CLLocation *locA = [[CLLocation alloc] initWithLatitude:Latitude longitude:Longitude];
CLLocation *locB = [[CLLocation alloc] initWithLatitude:app.lat longitude:app.lag];
CLLocationDistance distance = [locB distanceFromLocation:locA];

Thanks for Help!!

Unnati
  • 2,441
  • 17
  • 37
Priyank Gandhi
  • 1,257
  • 1
  • 16
  • 29

2 Answers2

1

You can do it using two ways :
1.

CLLocationCoordinate2D start = { c_lat, c_long };
CLLocationCoordinate2D destination = { [[dic valueForKey:@"business_lat"]doubleValue], [[dic valueForKey:@"business_long"]doubleValue] };

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]];

2.

Using Google API

In API you just need to pass origin name and destination name

Hope this helped....

Chirag Pipaliya
  • 1,281
  • 12
  • 20
0

This question describing how to compute bearing using the haversine function

Community
  • 1
  • 1
Engin Kurutepe
  • 6,719
  • 3
  • 34
  • 64