1

I am working on functionality where I need to animate car driving on the map which is similar to what Uber has for customer application.

Current approach: I receive latest driver's coordinate from the api after particular polling interval, I use latest lat long and last known lat long to calculate directions using MKDirection. Currently I am able to animate car on this polyline received via directions api but I am not sure how to calculate heading to rotate car in a particular directions.

Note: Client's requirement is to use apple's native maps and api available and not to use Google Maps api.

Any insights on computing heading will be helpful.

Javal Nanda
  • 1,828
  • 3
  • 14
  • 26

1 Answers1

1

Have you looked at this answer? https://stackoverflow.com/a/12696424/1364963

This should outline how to calculate a heading from two GPS coordinates.

Community
  • 1
  • 1
dzl
  • 908
  • 11
  • 32