How to keep the polyline follow exactly onto the road of the map

I’m Jin and I still have much to learn about mapping and navigation. I’m trying to build a navigation app by using OpenStreetMap with Flutter. I might need some guidance and sharing from you all. I’m not sure the method I used is correct.

I’m trying to use a combination of different sources to build my own navigation app. ( for the display maps I choose to use OpenStreetMap, for the routing feature I used Google Direction API to do the routing calculation)

Everything seems okay and good to me, the map is able to display and routing guides are working well. But when I display the route polyline on the map, the polyline seems to “go off the road” (refer to figure1), this happens most of the time when a turning is needed in front.

I have tried a number of times but I’m still facing this same problem. I might need some guidance and sharing from everyone, I’m not sure if there is anything I have missed or done incorrectly. Can anyone share with me, is there any method I can keep the polyline display and follow precisely onto the road of the map?

Thank you.

Figure 1

Hi tiramisujin, in my humble opinion, your trying to combine data based on different platforms. I dont expect that you will be able to match Googles (Meta) data with the Open Street Map data in any straight form.
And remember that the earnings in the data trade of Google differ from OSM !

Hi Hendrikklaas, thank you for your reply.
If so, it’s better for me to use OSMR for my turn by turn routing needs, is that correct?
Would you happen to know any open source navigation app using OSM with OSMR that you can recommend to me?
Thanks in advance.

It sounds like the thing that you’re asking for directions doesn’t have the same underlying data as the map you’re displaying those directions over, so it’s not a surprise that they don’t match.

What is your result when you start browsing the OSM wiki about https://wiki.openstreetmap.org/wiki/Routing and you try to find any piece of software that uses OSRM features?

Or are there any other solutions that can come near your aim?