-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.stack.imgur.com/OS2VM.png
Fabian
  • 78
  • 9
  • Ther is not too much information what are you using but i recomend to have a look at leaflet and animation marker. https://github.com/openplans/Leaflet.AnimatedMarker – Stefani Toto Jan 10 '22 at 08:40

1 Answers1

-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

Callan
  • 1,179
  • 1
  • 7
  • 18
  • 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 Jan 11 '22 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 Jan 12 '22 at 07:30
  • Ohh yes that's good, do you have an example with waypoints? – Fabian Jan 12 '22 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 Jan 13 '22 at 19:17
  • 1
    maybe this will help https://stackoverflow.com/a/59793208/15947768 – Callan Jan 13 '22 at 19:17