title: How to calculate elevation like in runkeeper application
body: <p>I have application that track user movement. And I store all relevant data lat/lng/alt etc.<br/>
  I am trying add elevation like on <a href="http://theruniverse.com/wp-content/uploads/2013/07/screenM_wqkone2013-07-06_19-45-34.png" rel="nofollow">runkeeper</a> just without graphic I need just to get elevation value.<br/>
  In my .h file:</p>
  
  <pre><code>@property (nonatomic) double netElevationLoss;
  @property (nonatomic) double netElevationGain;
  @property (nonatomic) double netElevationChange;
  </code></pre>
  
  <p>In my .m file:</p>
  
  <pre><code>- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
  {
      double elevationChange = oldLocation.altitude - newLocation.altitude;
      if (elevationChange &lt; 0)
      {
          netElevationLoss += fabs(elevationChange);
      }
      else
      {
          netElevationGain += elevationChange;
      }
  
      netElevationChange = netElevationGain - netElevationLoss;
  ...
  </code></pre>
  
  <p>I don't know is this correct way to calculate it.<br/>
  I have tested it and <strong>alt</strong> is for example <strong>182.53</strong> and <code>netElevationChange</code> is <strong>-182.53</strong>.<br/>
  Maybe it's good but maybe I am missing something any idea what I have done wrong here?</p>