2

To my impression, the compass of Google Maps in iOS works impressively well. I'm talking about the compass arrow of the small blue "My Location" dot in the map, see Google Maps SDK - My Location. It has been introduced in the recent version 1.7 enter link description here. I don't know how they manage to get such an accurate and stable compass but I want the same for my app which relies on precise heading information.

Therefore the question: is it possible to extract the heading angle from the Google Maps SDK?

user2980195
  • 163
  • 1
  • 10
  • Its not possible using Google SDK, There easiest way of getting the data creating a [CLLocationManager](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html) with track user heading enabled. This provides a [CLHeading](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLHeading_Class/Reference/Reference.html) object which contains heading (measured in degrees) relative to true north. – Shams Ahmed Apr 03 '14 at 16:12
  • 1
    Thanks, but this is not what I'm looking for. I know that one can obtain (a rather rough estimate of) the current heading via the CLLocationManager. To get precise heading information it's absolutely necessary to make use of the other sensors of the device as well, i.e. a sensor fusion algorithm. Apple offers such via the CMDeviceMotion (e.g. current attitude given in the latter). The point is know why I'm asking how to extract the heading from the Google SKD is because in my opinion they do a much better job than Apple here! Just compare the Apple compass with Google Maps' compass yourself... – user2980195 Apr 03 '14 at 17:25
  • You can move compass in Google maps here: http://stackoverflow.com/a/23489785/3607287 – Tharoth Aug 06 '14 at 05:01

1 Answers1

1

Need to set up location manager and call startUpdatingHeading:

self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self.locationManager startUpdatingHeading];

Then include the following delegate method and you should be able to extract the heading angle from newHeading:

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
  NSLog(@"Updated heading: %@", newHeading);
}
Lucas Chwe
  • 2,578
  • 27
  • 17