Determining path user is on based on GPS location

一个人想着一个人 提交于 2019-12-04 19:22:19
AlexWien

This is solved, it is called Map Matching.
I have written such a system for tolling purpose. There are variants related to be real time matching, like in navigation systems, or non real time like mine for post processing GPS data.
But in every case it is at least some month of developing effort.

Things start to get difficult if you have one trail which forks in two paths.
If you don't have a problem when the wrong path is matched in such situations, you can simply search the nearest one.

To avoid to much CPU power use a geo spatial index, like quad tree or k-d tree.

Graham Asher

Presumably you're using a map rendering API which draws the map from some data format. This is essentially a special-purpose database known as a spatial database. It should, in an ideal world, have an efficient function for finding all the roads and paths within a certain distance, say 50 metres.

Once you have that list of nearby roads and paths, which even in a heavily built up area, right next to a junction, won't exceed the low tens in number, you can go through them one by one and find the closest one to your GPS fix. There are standard ways to find the closest point to a line; there's a discussion here: get closest point to a line.

This system should (from my experience) be easily fast enough for GPS updates every second.

It's even faster if you're following a predetermined route, because then you need only check the segments of the route - and, of course, notify the user if he or she is too far from the route to be deemed to be on it, and then create a new route. That's what sat-nav systems do.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!