-2

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
1

1 Answer 1

-1

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

5
  • I think this is not the right or ? I do not need a service where I can plan a route from A to B. I need a service where I can send my tracked Geolocation Points and the service give me all points back to the nearest street soon can draw a polyline from this points and I should match exactly the street.
    – Fabian
    Commented Jan 11, 2022 at 18:29
  • you can add multiple waypoints (basically the whole route if you want) and it will draw the the polyline for you. Isn't this what you are looking for?
    – Callan
    Commented Jan 12, 2022 at 7:30
  • Ohh yes that's good, do you have an example with waypoints?
    – Fabian
    Commented Jan 12, 2022 at 18:31
  • not really. I only used it with 'origin' and 'destination' but I am sure you can find some in the documentation or on the web.
    – Callan
    Commented Jan 13, 2022 at 19:17
  • 1
    maybe this will help stackoverflow.com/a/59793208/15947768
    – Callan
    Commented Jan 13, 2022 at 19:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.