by Martin Dobias
This page is devoted to Quantum Navigator, a Python application for routing and navigation in roadmaps.
Much of its functionality is based on libraries of Quantum GIS.
This is how does it look like:
The aim of the project is to enable basic routing and navigation capabilities on a roadmap.
Given a shapefile of roadmap with correct format, you'll be able to select start and end
point of your route. The application will calculate you a route that will meet your needs
(shortest, fastest or economic path). This route should follow all restrictions like one-way
streets or turning restrictions from one road to another one.
Core of the application is due efficiency written in C++. Roadmap is internally represented
as a directed graph and the search for an optimal route is done with Dijkstra's algoritm.
User interface is written completely in Python and makes thorough use of map canvas, adding
several new map canvas items and allowing canvas interactions for road identification or
selection of start/end points.
You can download source files, they're released under the terms of GNU GPL.
For testing purposes there is one sample dataset - only non-commercial
use of it is allowed.
First of all, you need Quantum GIS version 0.9 or better. You can download it here.
In case you're compiling it from source by yourself, don't forget to build it with Python bindings.
Now proceed with installation of Quantum Navigation:
- Set your paths:
(You can create just a simple project in QGIS which will contain only the layer with roadmap)
- dglib/dgbuild.cpp: there are 3 #defines to be overridden
- QGIS_PREFIX - prefix of your Quantum GIS installation
- SHP_INPUT - path to the input shapefile with correct format
- GRAPH_OUTPUT - path to file with graph that will be created
- python/qnavigator.py: there are 4 paths
- qgis_path - the same as QGIS_PREFIX
- layer_file - the same as SHP_INPUT
- graph_file - the same as GRAPH_OUTPUT
- project_file - path to a QGIS project file that will be used for map viewing
- Go to Quantum Navigator directory and run from console:
mkdir build && cd build
ccmake . (in this utility set QGIS_PREFIX variable to the path of your QGIS installation)
This will compile routing library (dglib) and its python bindings (pydglib).
Also it will convert QT .ui and .qrc files to Python code
- Build the graph for routing
- Run Quantum Navigator
- user interface - the program consists of a windows with map view and a side panel with three tabs which are used for either controlling the program and displaying pieces of information.
- working with map - initially map view shows map with full extent. There are basic tools for navigation on map: pan, zoom in and out. It's possible to switch between them in menu or toolbar. It's also possible to use mouse wheel to zoom in/out. When moving mouse over the map view, longitude and latitude are shown in status bar.
- querying the roadmap - for inspecting metadata about roads, select identify road tool from toolbar. Clicked on a map it will highlight the nearest road and show its properties in a separate window. You'll be also able to see its startpoint (green cross) and endpoint (red cross) on map. In case the road segment has a preceding or descending segment (i.e. the one with the same road name), they're shown with dark green and dark red lines.
- creating routes - in "Routing" tab, you can select start and stop and the route will be calculated for you once both endpoints are specified. There are two ways how to specify an endpoint. First one is to set it from map, i.e. when clicked a point on map, the program will find the nearest point to any road of the roadmap and use it. The second possibility is to select the endpoint from list of roads (streets). In dialog, you'll enter a string that will be used as a filter for road/street names. When selected a road from list, a point in its middle will be used.
- route types - there are three possible route types: shortest, fastest and economic. The shortest route takes in account only the length of road segments. The fastest route prefers roads with higher level (assuming they'll be faster). Also it prefers going straight as usually it's faster either - in cost that you might be travelling longer distances. Finally, economic route optimizes also for speed, but not that much as the fastest route search does, thus it should end with a compromise between speed and distance.
- route information - when a route is calculated, in "Routing" tab it's possible to see total distance and directions in a list. Every line in the list means what road should be followed and for how long distance.
- GPS simulator - it's started on program startup. You can control it by adding waypoints (in "GPS" tab, select "Add waypoints" and click points on map). The simulator will start following them with specified speed and with specified time multiplier (i.e. 1.0 = normal time flow, 2.0 = twice as fast). The waypoints it will receive are set in a queue and are followed one after another. On the "GPS" tab, you can see also current position, GPS time and the road on which is the GPS aligned by program (if any). Once the application will be reaching a productive state, support for real GPS (e.g. reading NMEA or using gpsd) might be added.
- navigation - to start navigation from the current position to some other place on a roadmap, enter "Navigation" tab and set the destination. For every turn you'll be approaching, the application will show you what direction to turn to, together with the information how far are you from the next turn and from the destination.
- simulate route - to see how you would be navigated, click "Simulate route" and all points you should be following are added to GPS simulators queue so it will follow the route until destination.
Last updated: June 13, 2007