Moving car rotation depending on navigation like Uber app

I am trying to build moving car annotation instead of blue dot in swift for the real time gps tracker in iOS Apple maps. I tried using MkAnnotation with calculated angle but it has lots of issues and doesn’t work properly. Is there any other way I can achieve it in swift 4 . I tried searching for solution but everyone made in google maps. But looking for some solution in Apple maps. Thanks

Hi @netrah,
You will have to have a custom overlay in the form of an annotation. The way to rotate it is to get the co-ordinates and get the dx and dy (the difference between the last co-ordinates and the current one) to determine the direction it is taking.

if the difference between the latitudes is positive then it is moving eastwards, if negative then westwards, similarly if the longitude is positive it is moving south and if negative then north. If it is a combination of the two then NE, NW, SE, SW accordingly.

cheer,

cheer,

This topic was automatically closed after 166 days. New replies are no longer allowed.