How to get true heading from MapKit without CoreLocation ?

Discussion in 'iOS Programming' started by Bracer, Mar 16, 2010.

  1. Bracer macrumors newbie

    Joined:
    Nov 24, 2009
    #1
    The topic is a bit of a misunderstanding as MapKit uses Core Location itself.

    You can get a lot of useful data from MapKit itself:
    Code:
    self.mapView.userLocation.location.coordinate.latitude
    self.mapView.userLocation.location.coordinate.longitude
    self.mapView.userLocation.location.altitude
    self.mapView.userLocation.location.horizontalAccuracy
    self.mapView.userLocation.location.verticalAccuracy
    
    The only thing missing is true heading/magnetic heading.

    I understand that having two location manager trying to get GPS location will cause the CPS track to go horribly wrong and crazy [seen it with my own eyes as the "user location" jumps all over the place] hence I'm trying to see if I could just get all the data I want from mapkit itself.

    Any idea how I can get true heading/magnetic heading information from mapkit ?
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    What about using self.mapView.userLocation.location.course?
     
  3. Bracer thread starter macrumors newbie

    Joined:
    Nov 24, 2009
    #3
    Thanks dejo, unfortunately, it's course not true heading [immediate feedback upon rotation].
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    So, the compass doesn't feed data to the course property? I don't know; I'm just asking. If it doesn't, seems like you are going to have to find some way to get CoreLocation and MapKit to play nice.
     
  5. Bracer thread starter macrumors newbie

    Joined:
    Nov 24, 2009
    #5
    Ooo no Dejo :( The "Course" doesn't get its information from the compass, what it does is retrieve the "before" and "after" point of the CLLocation and then extrapolate the bearing a.k.a, what direction you are heading based on your previous location.

    Added to the fact that the previous location might not even be your previous location at all but iPhone's internal attempt to localize you resulting in horribly wrong bearings.

    But thank you dejo, you had been helpful :)
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    You're welcome.

    I'm still a bit confused about your issue: how is it that you would have two location managers?
     
  7. Bracer thread starter macrumors newbie

    Joined:
    Nov 24, 2009
    #7
    One is coming from google's Map Kit that uses CoreLocation.
    The other is from me.
     
  8. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #8
    Wirelessly posted (Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16)

    Does Map Kit still use a Core Location Manager even if you turn off showing the user location?
     
  9. Bracer thread starter macrumors newbie

    Joined:
    Nov 24, 2009
    #9
    If you turn off showing the user location, no.

    But no is so relative here, we don't really know what's going inside the MapKit Library, I did a test and confirm that all MapKit output [Latitude, Longitude bla bla bla] were shut down.

    But did they "nil" and "release" their manager ? or just stop location update ?
    Because if they were to just stop the location update, we will effectively have two location manager, one of which is mine, solely created just to get bearing [heading] information from location manager.

    Two location manager always spells bad news for iPhone development.
    Have you seen the "I am here" blue dot jumping around crazily as if you are teleporting ? This is what will happen when two location manager talks to one GPS Chip. [atleast in the iPhone]

    I am just hoping, since I can get so many information [PLUS VISUAL!] out of Mapkit, that I would be able to get heading out of it as well.

    Any luck ?
     

Share This Page