Hacker News new | ask | show | jobs
by Lx1oG-AWb6h_ZG0 3405 days ago
Every single mapping app has to implement some kind of mapmatching, since you can't rely on the GPS sensors to always be accurate: the GPS position is frequently wrong when you're moving between cell towers , and can be lost for several seconds in cities. Nokia/HERE's implementation (which I was told was very similar to tomtom/garmin's implementation) was written more than a decade ago, and IIRC, every time it encounters a fork in your path, it projects your position on every alternate for a few seconds and chooses the one that best matches the current gps+compass+accelerometer data as your "current" route. The output of this algorithm (which btw is hideously incomprehensible -- I'm talking old c++ with almost no comments) is what is used for map viewing/routing/guidance... the pure gps signal is never used as-is.
2 comments

> the GPS position is frequently wrong when you're moving between cell towers , and can be lost for several seconds in cities.

You seem to be thinking of cell tower triangulation, not GPS. I do agree that GPS also does not do particularly well in areas with large buildings: it needs a clear view of the sky which can be hard to come by when there's skyscrapers everywhere.

Actually, nowadays GPS rarely is used by itself.

Instead, you use A-GPS, which is GPS with additionally communication with a server for accuracy.

>which btw is hideously incomprehensible -- I'm talking old c++ with almost no comments

What does "old" have to do with it? Modern code is all like that too. Every time I complain about it, including just a day or two right here on HN, I get a bunch of responses saying "I don't need comments, my code is self-documenting". In my experience, most programmers do not use comments much at all, and it's entirely incomprehensible to anyone new to the project.