Tim Pearson
Tim Pearson

Reputation: 11

polylines on google maps not accurate

I have a transport android app and please try help me understand why the polylines appear to be moving irratically and sometimes completely off the road? Would it help to put bounds in that the new position can't jump more than a certain distance from the previous position? Thanks.

Upvotes: 0

Views: 1466

Answers (1)

kaho
kaho

Reputation: 4784

If you are displaying users' GPS locations as polyline on the maps, then you might want to snap it on the road with the Google newly published Google Maps Roads API's snapToRoads function.

Basically what it does it to correct the GPS information onto the road. Since 1 picture worth 1000 words, see it yourself.

enter image description here

But currently they only provided a restful and javascript API, for Android, you need to call it through the restful services.

Google provided a github project for that, you can check its MainActivity out here:
https://github.com/googlemaps/roads-api-samples/blob/master/app/src/main/java/com/google/example/maps/roadsapi/MainActivity.java

Upvotes: 1

Related Questions