iPhone GPS - any way to access speed/direction?

Discussion in 'iOS Programming' started by imrtt, Jul 19, 2008.

  1. macrumors newbie

    Joined:
    Jul 19, 2008
    #1
    Posted this in Mac programming forums first by mistake, my bad.

    Am I missing something, or is there no way to get speed/heading from CLLocation / CLLocationManager? I can't believe Apple would leave those attributes out.
     
  2. macrumors 6502

    Joined:
    Jun 26, 2008
    #2
    Given 2 position readings it's not hard to calculate. There's already a distance calculation. Given distance and time calculating speed is trivial. Calculating direction is a bit more involved and requires some trig, but even that's not that difficult.
     
  3. macrumors member

    Joined:
    Jul 12, 2006
    #3
    And there's always the accelerometer, so long as you aren't moving at a constant velocity...
     
  4. macrumors 65816

    Joined:
    Apr 19, 2004
    #4
    I don't have an iPhone 3G, but I have a wireless 3G modem with built in GPS. From OSX I can read the gps data directly from the serial port (i.e. just a file in the /dev/... directory). Maybe this is possible with iPhone OS with it's built-in gps? If you can figure out what the device file is.
     
  5. macrumors member

    Joined:
    Mar 23, 2008
    #5
    I believe that the 2.2 update has added direction and speed to CoreLocation
     
  6. macrumors member

    Joined:
    Sep 17, 2007
    Location:
    San Diego, CA
    #6
    2.2 adds the following to CoreLocation:

    CLLocation.course
    CLLocation.speed
    CLLocationDirection
    CLLocationSpeed

    Craig
     
  7. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #7
    The SDK provides no access to raw NMEA data. Instead you have to use Core Location.

    Prior to 2.2, you have to use some spherical trigonometry formulas and subtract coordinates to get direction, and DSP filtered numerical differentiation to get a good estimate for speed.

    .
     

Share This Page