How to keep marker on road? Google Maps Android
Asked Answered
L

1

7

I'm developing an app that tracks the GPS position of the user and shows it with a marker in the map. The updates are every 2 seconds.

The problem is the position I get is not so accurate than with other apps like WAZE, Maps, and so on. The user always is driving so is in the road, but the marker sometimes is about few meters left or right out.

Using the other apps this is not happening, like they know that you are in a road and snaps the position to it ignoring a little gps error.

So, how can I achieve this? I really need it!

Thank you so much in advance =)

Still nothing with this? Please help!

Lowestoft answered 2/6, 2014 at 18:33 Comment(2)
Are you using routes? If so you could use an algorithm that determines the closest point in the route to your navigation point and locks the marker into that position instead of the position you get from your GPS (which can be a bit off). This keeps you locked into the road. Not sure how to do this without the routes though.Lectionary
Thanks for your answer! I'm not using routes, the user is in "free run" mode. Even so, apps like I mentioned do the correction in that mode. I'm really stuck in this point.Lowestoft
V
3

GPS error for roads can be fixed by overlaying raw data on road maps. To achieve this for small scale, you can use a snap to roads API, available through mapping providers like Google Maps and OSM.

If you are looking for an end-to-end solution that visualises location data on the road, you can also try the HyperTrack SDK for Android or iOS. Location data from automotive drives is automatically snapped to roads. (Disclaimer: I work at HyperTrack.)

Verse answered 3/9, 2017 at 9:44 Comment(2)
Do you know how to add markers (even origin and destination) with Google Maps snap to roads APIFawcett
@Verse google snap to roads has a limit, path can't contain many points. the maximum number of points is 100 per request. I have tested it by myself, 500 points of lat/lng with 6 precision will throw an error "code": 400.Somatic

© 2022 - 2024 — McMap. All rights reserved.