What is GPS track navigation?
Given an array of GPS points (coordinates) and snapping these points to the existing road network to create a route that follows the “snapped points” (points that were successfully associated to a road) that’s what defines a GPX Navigation route.
Note: emphasis on “route” – the output is a route on which you can receive turn by turn navigation instructions
The input can come in the form of a GPX file (the GPX format is a common, open XML-based format used to exchange routes, tracks and waypoints between software applications – GPS devices usually record tracks in GPX format) or in the form of a GPS points array.
While there are similarities between a route with via Points (waypoints or intermediary destinations) and a route created from a GPX track or array of GPS points, they answer 2 different needs:
- if you want a route from A to D that goes through B and C then you need route with via Points (you don’t care about the exact path taken from A to D as long as B and C are on your path)
- if you want a route from A to D that follows a certain predetermined itinerary (roads and road segments) then you need a route from an array of GPS points (or a GPX track).
What can one do with this feature?
- Load a previously recorded GPX track and navigate it. A frequent “ask” for biking/running apps is to be able load a track that was created by another user and “follow it” – this can be either a picturesque run or a “challenge” – an attempt to best one’s time on the same itinerary
- Load a route calculated by an external routing engine in our SDK and receive turn-by-turn navigation instructions on that route. I.e. if you have your own custom routing engine that outputs a route (served as a set of coordinates), you can feed that to the SDK and it will provide navigation instructions as if it were a route calculated by our own routing engine
- something completely different J (here is where our developer community comes in)
Bosch has build one of the most complete all-in-one e-bike computers and one of their core features is the ability to load GPX tracks – be it a previously recorded track, a track recorded by another user or a route that you defined in their web portal and be “walked through” that track with visual and audio turn by turn instructions.
Graphmasters (a company that we previously covered on our blog) has build their own optimized routing engine based their “distributed swarm intelligence system” – they calculate a route in their computational cloud and then rely on our SDK to take you to your destination sticking to their route.
Behind the scenes
How does the GPX Track route calculation work?
We take the GPX track / set of points that was provided and we attempt to snap the points to our known road network, while evaluating all candidate roads based on the chosen routing profile. In case we cannot match a certain part of GPX/ set of points, the routing algorithm will “fill-in the gaps” and provide an alternative match.
Some of the things you should be aware of:
Car routing profile specific
- we can only use car accessible roads – i.e. if you provide us a route that goes on a foot path (not car accessible) that segment will not be patched, but an alternative road will be used
- we have to respect all known traffic rules – if your track has a left turn in an junction where our map tells us that only a right turn is allowed then the matched route will go right and it will find an alternative path to the next segment of the track
Routing on unknown roads
It could be that your routing algorithm has access to a more detailed road plan than what is available in OpenStreetMap (our default map data source), so it’s likely that the route that you will generate will go through roads that look like “empty areas” for our routing engine. The same case could occur if you are loading a GPX track recoded, during a hike in the mountains (no known roads or paths).
For the above scenarios, if you are asking for a car route then we will never be able to match on the your exact route (as a car route can only pass through roads we are aware of).
If you are asking for a bike or pedestrian route, then you might be able to get a route on your roads, provided that you “convince” our routing engine that this is your intention
Bike/pedestrian routing profile only: if you provide just 1 point (or a few points) for the unknown road/road segments, then, when evaluating them, the matching algorithm might choose to ignore them as potential “GPS reading errors” (you expect a certain level of inaccuracy when dealing with coordinates, so it’s more likely that a point in the middle of a field is a “low quality GPS reading” than a point on a road which we are not aware of).
To overcome this, you need to provide dense enough points so that the second option (road which we are not aware of) becomes more feasible – for optimal results provide a density of 1 GPS point every 25m should suffice.
For the segment that was matched on a road that the SDK is not aware of, there won’t be any turn by turn directions but only compass guidance (indicating the direction you should be heading to remain on road)
Handling rerouting calls
If, while navigation on route generated from a GPX track, the user moves away from the route, a rerouting call will be triggered and a new route will be generated.
This new route will try to adhere as much as possible to the original route the goal being to “get back on track” as soon as possible. By contrast, in normal routing the route calculated after a rerouting call will try to get you to your destination as quickly as possible.
Getting started with GPX track navigation
In the demo projects we’ve included multiple examples of this, behind the “Tracks” menu entry.
The feature is open to evaluation under the standard plan, but requires a commercial license before being used in public/commercial products (reach out to our support team for details regarding this).
I hope you’ve enjoyed this (lengthy) article and I’m looking forward to your feedback & questions regarding this feature.