1

I'm developing a gps tracking system that sends it's coordinates to my phone through a server. The only problem with this system is that the gps can't always be precise and it fails a few meters. This means it could point to the opposite side of road while driving. And when i want to route these coordinates, instead of routing properly, it gives back a wrong route.

I'm curious about this problem. I haven't find any parameters in the Directions Url that could switch off rules of the road. That would be great in this situation. Maybe is there any solution?

The method i'm using is that i make a query on my server, it gives back coordinates, then i route the first coordinate with the second, the second with the third and so an. (based on time stamp)

I hope i wrote down clearly my problem. Although i felt unnecessary to post my code, on request i will update the post with that.

As you can see, on "Nyugati u." it should show only one route instead of two.

tamasJozsa
  • 86
  • 1
  • 12
  • I don't understand the problem. So you can get the direction on how to go from point A to point B, and while moving, you update point A, and point B won't change because that's your destination, right? So the current location function can be a little off, but as long as you have a final destination, you just keep drawing route to that point using the direction api. Honestly, don't really know what you are trying to do... – so_jin_ee Apr 13 '15 at 16:59
  • @tamasjozsa if you're passing mode=driving for google maps directions api then this can happen. – Amrut Dec 09 '15 at 07:14

1 Answers1

0

you need to snap your gps latlngs to polyline you get from directions api. google does not track your previous request and just calculating route from origin you have provided.

You can calculate your current bearing and check if google directions result tooks you back and ignore it.

There are some methods to avoid gps jittering see

Fuad All
  • 871
  • 11
  • 13