google-mapsionic-frameworkgeolocationgoogle-geolocationgoogle-roads-api

Matching Geopoints to road on map


I tried to create an app which track the current user position and I want to display it on a map.

The problem is, when I drive by car I get 2 geopoints and if there was a curve between, then it only draws a straight line. But I would like to draw the line on the road because of logical thinking, a car only drive on a road. How can I realize that?

Here is my backgroundGeolocationConfig where I tried to set the to the lowest but it also does not work, the result is in the screenshot below.

const config: BackgroundGeolocationConfig = {
        desiredAccuracy: 5,
        stationaryRadius: 5,
        distanceFilter: 5,
        activitiesInterval: 1000,
        activityType: 'AutomotiveNavigation'
      };
    ```

[![enter image description here][1]][1]


  [1]: https://i.sstatic.net/OS2VM.png

Solution

  • I strongly recommend Google Direction API. It is free until a certain point, but it will fit your needs. Check out more here

    https://developers.google.com/maps/documentation/directions/overview