Introducing Quantum Navigator


It's been quite a long time since my last blog post. In the meantime I was quite busy with getting my bachelor thesis ready. It's about creation of a simple navigation system for vehicles. In case you'd be interested you can take a look at the thesis [PDF], but it's quite tough reading as it's written completely in Slovak language :-)

But the more interesting thing is that second part of the work was implementation of a routing/navigation system and I've chosen Quantum GIS and Python to do it. This implementation is now available online, it's called Quantum Navigator (guess why!) and licensed under the terms of GNU GPL.

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.

There's a GPS simulator that can be controlled by clicking waypoints on map (simulator will follow them) and specifying its speed. When in navigation mode, the application will give you turning hints when approaching a crossroad.

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.

Development of this application helped me to identify some areas in libraries of Quantum GIS that need more attention - classes with a cluttered interface, classes with unclear or too complicated usage etc. It was also a first greater test for QGIS Python bindings and helped to fix several severe bugs in the bindings.

Actually much of my previous work was leading to enable (or make simplier) creation of 3rd party applications that would use map canvas (and other functionality) from Quantum GIS. Now everything's getting slowly to the state when Quantum GIS libraries can be used well for a number of different desktop mapping/GIS applications.

A painful issue with Quantum Navigator is unavailability of detailed roadmaps with all metadata needed for good routing. For testing purposes, I've got permission to make available a small part of a commercial dataset which covers my hometown Trencin, Slovakia and surroundings. Maybe at some point in future, OpenStreetMap project will be mature enough to serve as a good alternative, but now it can't be used at all due its poor overall coverage and lack of turn restrictions.

I don't think that this application will ever get to a fully usable state when one would be able to use it with a GPS receiver in a car for navigation. I'm rather of the opinions that it might serve well as a source for example usage of Quantum GIS API and Python. But of course patches are welcome if you'd like to contribute some new functionality.

That's all for now, gotta start learning for the final exams at the end of June...

What GUI?

Hi Martin, nice work with the navigator.
It would be useful if I can make interfaces for my work output and I thought about learning Python as universal glue. But I don´t know what GUI module to use for Python. Which one did you use? The same Qt?, WxPython, tk?

Your comments on this matter will be much appreciated,

Adolfo

Python GUI Choice

Hi Martin:
I a new to Python and I have to choose a window making module for Python. What have you used for your GUIs?

Adolfo

Installation of Quantum Navigator

I downloaded the source code of quantum navigator but i could not install and able to use it in QGIS. i am new to GIS and QGIS, could you help how to install and use quantum navigator in QGIS? i need it for my term project :((

Plugin Compile Error

Just in case you bump into the same error below...

[root@rupert-linux build]# make
[ 36%] Built target dglib
Scanning dependencies of target dgbuild
[ 45%] Building CXX object dglib/CMakeFiles/dgbuild.dir/dgbuild.o
/home/install/qgis-svn/src/plugins/qnavigator/dglib/dgbuild.cpp:183: error: expected `,' or `...' before '&' token
/home/install/qgis-svn/src/plugins/qnavigator/dglib/dgbuild.cpp:184: error: ISO C++ forbids declaration of `QgsPolyline' with no type
/home/install/qgis-svn/src/plugins/qnavigator/dglib/dgbuild.cpp: In function `QList vectorToList(int)':
/home/install/qgis-svn/src/plugins/qnavigator/dglib/dgbuild.cpp:186: error: `QgsPolyline' is not a class or namespace
/home/install/qgis-svn/src/plugins/qnavigator/dglib/dgbuild.cpp:186: error: `const_iterator' was not declared in this scope
...
...
/home/install/qgis-svn/src/plugins/qnavigator/dglib/dgbuild.cpp:258: warning: unused variable 'QgsAttributeList'
make[2]: *** [dglib/CMakeFiles/dgbuild.dir/dgbuild.o] Error 1
make[1]: *** [dglib/CMakeFiles/dgbuild.dir/all] Error 2
make: *** [all] Error 2

You need to set the QGIS_PREFIX_INSTALL so CMAKE would know where to find the include and lib files. For more information please visit this thread

free roadmaps with routing

In Poland there is an UMP project [0] (Uzupelniajaca Mapa Polski - in English usually called "Unnoficial Map of Poland"). It is a free geo dataset (licensed under Creative Commons Attribution-Share Alike 3.0 License [1]) for Garmin GPS receivers, daily updated by volunteers [2] using CVS. Also usable on Pocket PC by the means of Garmin QUE and gpsproxy [3]. Provides routing, detailed, actuall roads network, POIs etc. Most of the Poland is covered. Warszawa (Warsaw) is maintained most actively AFAIK and also available as a separate dataset.

They use the PFM (so called "Polish format"). Specs are available in cGPSmapper manual [4] and more background here [5]. One can translate PFM into shapefile with freeware software like [6]. More, different purpose, worldwide PFM maps, here [7] and here [8].

Note: I haven't used any of these myself. Just merged the relevant info as I thought it might be of interest for you.
Sorry that much of the information is in Polish, but hopefully it is not an entirely foreign language for a Slovak :).

[0]http://ump.waw.pl/
[1]http://ump.waw.pl/licencja.html
[2]http://ump.waw.pl/sklad.html
[3]http://gpsmaniak.com/new/mapy-GarminQUE.htm
[4]http://www.cgpsmapper.com/manual.htm
[5]http://tttan.com/HT/blogread?U=ld&T=1127337277
[6]http://www.msh-tools.com/Ptxt2shp.html
[7]http://mapcenter.cgpsmapper.com/catalogue.php
[8]http://mapcenter2.cgpsmapper.com/catalogue.php

Maciek

pgRouting with heuristic algorithm

Very interesting! Quantum Navigator looks nice!
Have you been aware of pgRouting? (htt://pgrouting.postlbs.org)
Dijkstra is slow if you have big road networks. Using heuristic algorithms can improve speed. But probably QGis itself might have problem with very big shape files, I guess.

GMap, Roadster and RoadNav?

Very interesting :-) Félicitations! Are you aware of these three similar open source projects?

Interesting

I wasn't aware of these apps. Thanks for pointing them out!

and gpsd too!

I assume you are using Gpsd for the GPS end of things?
(http://gpsd.berlios.de)

Hamish

and don't forget GpsDrive

Don't forget GpsDrive (www.gpsdrive.de) for navigation and GRASS's v.net.* and d.path modules for shortest path routing (grass.itc.it) -- accessible from the QGIS/GRASS toolbox.

Hamish