title: Move GMSMarker on Google Map Like UBER
body: <p>I am developing some navigation tasks on google map. I have to move markers as vehicles moves with turns as uber does in their app. I have tried different solutions as offered on @SO but It is not working as I need. </p>
  
  <p>I am getting angle with previous lat/long with current lat/long and animating mapwithBearing with that rotation</p>
  
  <p>Here is code</p>
  
  <pre><code>[CATransaction begin];
  [CATransaction setAnimationDuration:2.0];
  NSDictionary *data = [[result objectForKey:@"returnData"] objectForKey:@"data"];
  if (![data isEqual: [NSNull null]]) {
      driverLocationCoordinate = CLLocationCoordinate2DMake([[data objectForKey:@"lat"] doubleValue], [[data objectForKey:@"lng"] doubleValue]);
      driverMarker.position = driverLocationCoordinate;
  
      GMSCameraPosition * camera = [GMSCameraPosition cameraWithLatitude:driverLocationCoordinate.latitude
                                                                       longitude:driverLocationCoordinate.longitude
                                                                            zoom:16];
  
      mapHomeView.camera = camera;
  
  
      if ([data objectForKey:@"preLat"] != [NSNull null] &amp;&amp; [data objectForKey:@"preLng"] !=[NSNull null]){
          if ([[data objectForKey:@"preLat"] floatValue] != 0.0f &amp;&amp; [[data objectForKey:@"preLng"] floatValue] != 0.0f) {
              NSLog(@"pre_lat = %f and pre_lng = %f", [[data objectForKey:@"preLat"] floatValue], [[data objectForKey:@"preLng"] floatValue]);
              CLLocationCoordinate2D previousCoordinates = CLLocationCoordinate2DMake([[data objectForKey:@"preLat"] floatValue], [[data objectForKey:@"preLng"] floatValue]);
  
          driverMarker.rotation = [self DegreeBearing:previousCoordinates locationB:driverMarker.position];
          [mapHomeView animateToBearing:driverMarker.rotation];
          }
      }
  
      [CATransaction commit];
  </code></pre>
  
  <p>I just taken degree code from another @SO post, It works when I'm on straight road but when car is still or turning, it gives flickering</p>
  
  <p>Here is code of getting angle from another SO post.</p>
  
  <pre><code>-(double) DegreeBearing:(CLLocationCoordinate2D) A locationB: (CLLocationCoordinate2D)B{
      double dlon = [self ToRad:(B.longitude - A.longitude) ];
      double dPhi = log(tan([self ToRad:(B.latitude)] / 2 + M_PI / 4) / tan([self ToRad:(A.latitude)] / 2 + M_PI / 4));
      if  (fabs(dlon) &gt; M_PI){
          dlon = (dlon &gt; 0) ? (dlon - 2*M_PI) : (2*M_PI + dlon);
      }
      return [self ToBearing:(atan2(dlon, dPhi))];
  }
  
  -(double) ToRad: (double)degrees{
      return degrees*(M_PI/180);
  }
  
  -(double) ToBearing:(double)radians{
      return [self ToDegrees:radians] + 360 % 360;
  }
  
  -(double) ToDegrees: (double)radians{
      return radians * 180 / M_PI;
  }
  </code></pre>
  
  <p>Can anyone help on this or propose any other solution?</p>