17

Navigation systems like the Garmin and TomTom have always fascinated me. I've wanted to implement small map/navigation applications to try out various pathing algorithms and expand on my knowledge of them.

This is a two part question:

1.) How is Map data stored? - When you have a network of roads, how is this data generally stored? What parts of the data are retained inorder to reproduce a map later? Is each road stored as a series of points where it changes direction? What kind of file formats is this data stored in? Are there publically available libraries for easily parsing these files? Does anyone have specifics on how map/road data is stored/represented it would be very helpful.

2.) Navigation/Pathing - When doing basic pathing on this map data (a la Garmin) is my assumption correct that it is converted to a directed graph? Is each road intersection a vertex with the edge weights the distance between vertexes? This is what I was thinking about doing so I could try some basic well known pathing algorithms and see what I get.

I've seen this publically available map data on the US but I'm not sure how it is represented and if it is detailed enough for me to be able to build my directed graph out of it.

If anyone has any information I would appreciate it. The more detailed knowledge you have the better.

TylerH
  • 20,799
  • 66
  • 75
  • 101
mmcdole
  • 91,488
  • 60
  • 186
  • 222

6 Answers6

9

The previous responses all refer to GIS sytems. This is not how PNDs (Portable Navigation Devices) work. They're far too simple to run desktop/workstattion level GIS software.

Instead, PNDs store information pretty much as Simucal presumed. Roads are broken down into segments. This keeps the model a lot simpler. Within a segment, attributes like maximum speed don't change.

For planning purposes, road segments act as the edges in a graph. For each nodes, incoming and outgoing nodes are both stored. Planning is then done using a modified A* algorithm. Edge weights are typically not distances, but estimated travel time (or in TomToms case, actual, measured time).

Road networks are typically hiearchical, though, and normal A* is a slow starter. When travelling from one town to another, A* will spend excessive amounts of time crawling through the start town. However, we humans know it's best to use highways when travelling longer distances. That's what they're built for. PNDs likewise prefer highways. And as highways are a lot rarer, this saves a lot of memory.

Another optimization is forward and backward search; you plan from both sides towards some middle point. The big advantage of this is that if you take a wrong turn, you can search again from a new start point. The backwards search tree is unchanged as your destination didn't move.

MSalters
  • 173,980
  • 10
  • 155
  • 350
6

I don't know specifics about navigation system units, but in the standard GIS world, map data is stored basically as a collection of polygons, lines and points, each described by its coordinates (and the projection used and some other parameters). For instance, one of the most common formats, shapefiles, is described here, and the database based format standard is here.

I've successfully used this storage model for roads display and route calculation, using PostgreSQL, PostGIS and PGRouting. Calculations are done using the usual graph algorithms and the data stored in the common format is stored also as a graph to allow for their application. I can't extrapolate that experience to an embedded device as they likely do it very differently given their limited computing capacity. They very probably precalculate lots of stuff.

For a somewhat different approach to storage, check OpenStreetMap

Vinko Vrsalovic
  • 330,807
  • 53
  • 334
  • 373
2

The exact way it's stored depends on the format; there are heaps of different GIS formats. GDAL is an excellent free library for reading (almost) all of them.

Typically roads will be stored in the file as a "lines layer", that is a set of polylines with attached metadata. So each road will have a series of vertices, and depending on the quality of your data it will hopefully have information such as whether they're one-way or not, speed estimates and some sort of connection id.

Yes, they're normally converted to a directed graph for solving. Edge weights may be distance or, more usefully, the time taken to travel that edge.

Solving quickly is a tradeoff between precomputation and storage space (an embedded device may necessitate a different choice here to a PC). There are some very interesting algorithms out there for doing that.

Peter
  • 7,216
  • 2
  • 34
  • 46
2

Mohammed: Okay, I didn't go into much detail there because the original question seemed pretty comfortable on that aspect. If you aren't familiar with graph theory, it's probably a good idea to do a bit of reading on it now - Wikipedia is fine for an introduction.

What typically happens is that in the GIS data the roads are stored as polylines with attached metadata. That's fine for displaying them onscreen etc, but to be able to navigate them you need to know which ones are connected to one another. So in the metadata there's normally a node id for each end of the road, so you can say "this is road segment 457, it goes from node 332 to node 667". So when you read in the GIS data you build up a representation of it as a set of nodes connected by arcs (ie. a graph).

If that metadata's not available you could infer it from which roads have the same start/end coordinates (this is the case with some not-so-wonderful GIS data). The "directed" bit just means that roads have direction - some of them can be travelled along in either direction, but others are only one-way.

The typical algorithm for finding a path through a digraph is Dijkstra's algorithm; various derivatives are used in practice. Basically that involves moving from node to node along the arcs of the graph, so you need the appropriate data structures to support that.

Hope that helps...

Peter
  • 7,216
  • 2
  • 34
  • 46
  • @Peter, Do you know anything about people also storing the map data in a spatial tree like a QuadTree or R-Tree? I know this allows you to query for only elements within x amount of distance. Would that be used for rendering then? To only render a within a certain radius or another usage – mmcdole Oct 23 '08 at 03:29
  • @Peter, Thank you for your comments by the way. I want all the information I can get on GIS fileformats. I have an "ok" knowledge of Graph Theory.. it is just everything else that I have questions about ;) – mmcdole Oct 23 '08 at 03:30
2

If you want some code to look at to get some idea about how routing applications work, try having a look at some of the routing applications linked from the openstreetmap.org wiki. Navit and Gosmore are both open source and fairly easy to set up in particular.

Nic Roets, the developer of the Gosmore application wrote an interesting post about his choices for representing the road-vector data that may be of interest to you as well.

If you want to have a look at Gosmore in action, it is the backend of the yournavigation.org routing website based on openstreetmap data.

David Dean
  • 7,435
  • 6
  • 33
  • 41
-2

For improved drawing speed at the cost of more storage and limited resolution, many applications will use a georeferenced raster format such as GeoTiff.

Given the rather insistent comment by Zich below that

"Data are in vector in all Navigation systems with no exception!"

I thought I'd add a bit to the above. Firstly, I'd define a navigation system as a system that assists you how you get to where you want to go based on your current location, typically by costing a number of possible alternative routes and recommending the lowest cost one. Possible routes may be dictated by mode of transport, cars stay on roads for example whereas hill walkers don't. Costing of routes may vary by mode of transport too as well as user requirements. Cars might want to take quickest route based on road speed, trucks might want most fuel efficient route, hill walkers might want the safest direct route, boats or aeroplanes might want a route that avoids dangerous weather systems, while also minimising fuel cost and time spent.

At the most simple level a map and compass is a navigation system. Replace the map with a small screen, a scalable raster map and a GPS and you still have a navigation system. Most low to medium end maritime navigation systems still work this way, with charts representing the coastline and seabed and GPS to give you location, and echo sounding for depth.

At the more advanced end of the spectrum, autonomous robotic navigation systems such as the Mars Rover navigation system generate DTM models on the fly as a basis for short range navigation, and satellite gathered DEMs for longer range navigation.

To suggest that all navigation systems work like consumer Garmin or Tom Tom devices is a rather naive presumption. FWIW, many modern Garmin devices also include raster based DEM data where low cost GPS heighting can be wildly inaccurate.

SmacL
  • 22,555
  • 12
  • 95
  • 149
  • Data are in vector in all Navigation systems with no exception! – Iman Nia Feb 03 '17 at 22:22
  • @Zich, must be a nice thing to know about ALL navigation systems. Have a brief look for autonomous robot navigation and you'll see many hits involving point clouds, such as this http://www.robotics.unsw.edu.au/u10/Autonomous-navigation-using-a-real-time-3D-point-cloud where GeoTIFFs are regularly used to represent mappable terrain surfaces as pointclouds (i.e. DEMs). Such systems search for lowest cost routes no navigate based on generation of profiles from a DEM (typically raster) or DTM (typically vector based TIN). – SmacL Feb 04 '17 at 09:22
  • Yeah it is!(all navi...) its like, you said some cars use railways! I am saying no! All of the automobiles have wheels and they don't use rail ways! Simple! And yes it is a generic rule, Shortest path analysis can be executed over raster data in GIS softwares(i.e using Corridor function in Arcgis) but its not a navigation system! Many of above answers should take a down vote for sure but yours I just couldn't ignore. – Iman Nia Feb 04 '17 at 21:20
  • Wrong. All navigation systems do not use vector based maps, because not all navigation systems have vector based maps available to them. Some systems generate local mapping on the fly via sensors, which is point rather than vector based. Some use aerial or satellite based DTMs or DEMs and develop a series of ground profiles for potential routes and then choose a route to take based on cost and obstacles, i.e. the Mars rover navigation system; http://mars.nasa.gov/mer/home/posters/OpportunityPosterBack.pdf – SmacL Feb 05 '17 at 08:37
  • Nasa vehicles also use chains instead of wheels!!!!, but I am not talking about them, neither we are talking about cloud points application in artificial navigation. Read the question again and provide me an example if you can with a vehicle that uses raster data instead of vector. Do you know any car that has a navigation system based on something other than vector data? Also DEM and DTM has both raster and vector examples which is considered off topic so I am not going to explain it. – Iman Nia Feb 06 '17 at 18:38
  • @Zich, your original comment was 'ALL navigation systems with no exception'. not cars. I've linked many such navigation systems, which is a considerably bigger topic than cars following roads based on vector maps. – SmacL Feb 07 '17 at 06:38
  • I meant all cars, The Question is about cars navigation, not freaking Mars riders! Your answer deserve down vote, cause its misleading the questioner, – Iman Nia Feb 08 '17 at 14:05
  • Maybe if you meant all in car navigation systems you shouldn't have said 'all navigation systems no exception' so. FWIW many new Garmin navigation systems also include DEMs for heighting and height based costing of routes that are used in conjunction with vector maps. – SmacL Feb 08 '17 at 14:30