Navit is an open source navigation system with GPS tracking.
It works great with a Raspberry Pi, a GPS module and a small TFT with touch, jut like the official Raspberry Pi Display or PiScreen.
In this guide, we will be using;
- A Raspberry PI 3
- The official Raspberry Pi Display
- SmartPi Touch
Setting up the GPS
Navit can be installed without a GPS connected to your Raspberry Pi, but you will not be able to use the real-time turn by turn navigation. You will however be able to browse maps. If you are not going to use a GPS, you can skip to the next step.
As we are using the BerryGPS-IMU, we will be following the guide in the link below. As most GPS modules use serial to communication, this guide can be followed for other GPS modules.
BerryGPS Setup Guide for the Raspberry Pi
The images below shows how we have connected the BerryGPS-IMU to the Raspberry Pi 3 whilst it is in the SmartPi Touch case.
If you plan on testing this out in your car, you need to be mindfully of where you place your BerryGPS. In my setup and I have placed it in the air vent as shown below, and BerryGPS gets a good strong signal.
If you are using an external antenna, then there is no need to worry about where your BerryGPS is placed.
Apply any updates;
pi@raspberrypi ~/ $ sudo apt-get upgrade
We will copy the default Navit config folder under the home directory.
pi@raspberrypi ~/navit-build $ cp /etc/navit/navit.xml .navit/navit.xml
You can now run Navit;
If there is no GPS signal, Navit will default to Munich as shown below. If you have a GPS signal, you will most likely have a blank screen as Navit has moved to the coordinates from your GPS and there is no map install for that location (yet).
Navit can use Garmin or OpenStreetMaps(OSM). In this guide we are using OSM.
Go to http://maps9.navit-project.org/ and download your map.
The file will be named something silimiar to this; osm_bbox_151.1,-33.9,151.3,-33.7.bin
We will rename it so it is easier to read. And place it under /home/pi/maps
pi@raspberrypi ~/ $ mkdir ~/maps
pi@raspberrypi ~/ $ mv sydney.bin maps/
The Navit config file needs to be edited to include the new map. While we are there we will also disable the sample map that came with the source.
To disable the sample map, look for;
<!-- If you dont want to use the sample map, either set enabled="no" in the next line or remove the xml file from the maps directory --> <mapset enabled="yes"> <xi:include href="$NAVIT_SHAREDIR/maps/*.xml"/> </mapset>
And changed enabled to “no”
<!-- If you dont want to use the sample map, either set enabled="no" in the next line or remove the xml file from the maps directory --> <mapset enabled="no"> <xi:include href="$NAVIT_SHAREDIR/maps/*.xml"/> </mapset>
To enable the map which was just downloaded, look for;
<!-- Mapset template for openstreetmaps --> <mapset enabled="no"> <map type="binfile" enabled="yes" data="/media/mmc2/MapsNavit/osm_europe.bin"/> </mapset>
And set it to enabled and specify the location of the bin file which was just downloaded. And set enabled to yes.
<!-- Mapset template for openstreetmaps --> <mapset enabled="yes"> <map type="binfile" enabled="yes" data="/home/pi/maps/sydney.bin"/> </mapset>
Navit can also read out the directions when navigating.
<speech type="cmdline" data="echo 'Fix the speech tag in navit.xml to let navit say:' '%s'" cps="15"/>
and change it to;
<speech type="cmdline" data="espeak '%s'" cps="15"/>
The default locale is set to United Kingdom/English. Which means that the default country when searching for an address will be United Kingdom.
If you are not in the United Kingdom, then it is best to change this.
In navit.xml, look for
And change it to your specific locale;
<config xmlns:xi="http://www.w3.org/2001/XInclude" language="en_AU">
As I am in Australia, I have set it to en_AU. Now when I search for an address the default country is Australia.
Some other examples are;
Open Full Screen
To force Navit to open in full screen, look for;
<gui type="internal" enabled="yes"><![CDATA[
and change it to
<gui type="internal" enabled="yes" fullscreen="1"><![CDATA[
When using Navit in navigation mode, we want the screen to update as the vehicle moves. By default, the screen will only update once the vehicle reaches the edge of the screen.
<vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="gpsd://localhost" gpsd_query="w+xj">
and change it to
<vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="gpsd://localhost" gpsd_query="w+xj" follow="2">
A value of 2 would refresh the screen every two seconds.
With the default config file, Navit is hard to use with a touchscreen, an example of this is in the screenshot with Munich above.
One of the good features of Navit is that it almost everything is configurable.
We want to add some buttons and some routing information like next instruction, distance, speed, etc.. And hopefully it will look like the below screenshot
The config for Navit is found in ~/.navit/navit.xml
We will edit this file so that the display looks as shown above. You will also need to download the customs icons.
Download the configs needed for navit.xml
If you are using the Raspberry Pi official display, download this config file or use wget;
If you are using a 3.5″ TFT, like PiScreen or PiTFT, download this config file or use wget;
Then download the icons;
Extract the icons from the zip file into the directory where Navit stores icon images;
No we will added the config from the downloaded text file to the Navit config file.
Open the config file;
Insert the new config in just before the lines below;
<!-- for a debug log --> <log enabled="no" type="textfile_debug" data="debug_%Y%m%d-%i.txt" flush_size="1000" flush_time="30"/>
The next time you start Navit, it should look as shown in the above screenshot.
Other Useful Navit Modifications
Width & Height
To specify the width and height of the Navit window, look for this
And change it to something like this;
<graphics type="gtk_drawing_area" w="600" h="400"/>
Disable Points of Interest
To permanently disable points of interest, look for;
<layer name="POI Symbols">
And disable it as shown;
<layer name="POI Symbols" enabled="no">
47 thoughts on “Navigating with Navit on the Raspberry Pi”
Couple ?’s. First thanks for the write-up ! Great info. I have the same setup only with a GPS dongle. Everything seems to work except how do I center the map on the GPS fix ? I have Lat. and Long. in but it’s a little off. Also change the speed to MPH for US. Haven’t got the map to follow the vehicle either. Did add follow =”2″. Any ideas ?? Thanks !
follow = 2in the
vehicletag should work. this tells Navit to update the screen every 2 seconds.
To change to mph, in the Navit tag, enter
Looking at the notes in navit.xml, they seem to indicate ‘follow=”2″‘ tells navit not to center the vehicle in the screen. I believe the switch is “1” for on and “2” for off. The code: active=”1″ may be changed to cause the screen to update at different intervals, 1 being one second.
Hey, im not sure how to activate the new buttons. I just need to open the .txt und copy this stuff into the two lines you wrote?
Thx a lot for your guide
download my txt file and copy the contents into navit.xml on your Pi
Thanks for the blog post. Have got it working on the Raspberry Pi.
Is there any way to trace out your route on Navit? In other words to show where you have been?
This write-up saved me hours of work. Thank you very much.
I changed the speed to mph, but the altitude seems to still be in meters. Anyway to set that?
Great project. Can the current time be displayed on the map as an icon?
Looks straight forward. I have just ordered a BerryGPS-IMU board and antenna from Amazon, for my Raspberry Pi 3. I looked at your Pi setup guide but I don’t see where you specify the GIPO pin connections but in this guide I see there are 3 used. Can you clarify this please.
The BerryGPS-IMU can sit directly onto of the Raspberry Pi. However, in this guide this wouldn’t have worked as the Raspberry Pi is mounted behind the TFT and the GPS module wouldn’t have had access to the sky. So it was just connected by 3 jumper cables, 3.3v, GND and RXD .
Questions about navigation. When I enter a town that I want to set as the destination. It is giving me locations that are not on the map I downloaded. Any suggestions as to how to correct this?
how do you recommended getting navit to launch the GUI at startup?
Did anyone try Navit on Raspbian stretch? i did follow the above mentioned steps and get the map loaded, but i dont see any buttons to Zoom in and out or the speed. i just get the map loaded. on checking i get many errors in the terminal. can any help me to fix the issue.
Thanks in advance!!
I enabled the zoom buttons in ~/.navit/navit.xml as follows — the zoom buttons then appear when next starting navit:
This worked on my pi.
Hi ibi, how did you get the zoom buttons enabled, please
I’ve got Navit working on my raspberry pi, with a gps giving the correct position, but cannot see how to put zoom buttons on the map!
I’ve downloaded the maps bin file, renamed and moved it to /etc/navit/maps.bin.
I’ve also enabled to use openstreetmaps and edited the location to the bin file but when I run “navit” i get a blank yellow screen with no map. I DO NOT have a GPS antenna installed yet.
Mu assumption is that it is still opening up to Munich (default) location, and Munich is no longer the current map.
Have you tried to search a location in the map you downloaded?
Did you ever get that working? I had the same issue where navit just displayed a yellow empty screen upon launch, It however had loaded the map but was zoomed in at a different lat/long, I zoomed out all the way and noticed some text at a different location, manually centered around that and slowly zoomed in, and voila the map finally appeared.
You can edit navit.xml and enter the location you want the map to open up to
“On Navit’s very first startup, it needs a center to look at on the map. By default this is set to Munich in Germany (at latitude 48.08 and longditude, which is conveniently covered by the sample map created on installation.”
center=”4808 N 1134 E”
How do I enable SDL graphics on navit?
It would be great if this would be the default values.
There would be higher adoption of Navit!
Hi, thanks for the tutorial. it is very good. one question though. any ideas on how to enable a button to center the map on the current location?
Thank you so much for this post!!
Just a small help. I need to track the ‘TURNS’ of the vehicle. Anyway I could get that, I mean any tags?
Thanks in advance, keep the good work!
I am new at this.
I ran into an unusual situation running your procedure on a raspberry pi 4:
After the original install, due to a corrupted navit.xml file I attempted to remove the navit application and after numerous attempts ( install/uninstall) i found a copy of the navit.xml in a hidden directory (not visible in file manager but accessible from terminal). I was able to finally delete this phantom file and only after a reboot does it appear to be finally deleted. Any thoughts?
these hidden files are the config for Navit. if you like to customize the navit.xml, chose this one
Hello I follow the procedure but when run the navit it has these error
error:navit:xinclude:Unable to include /usr/share/navit/maps/*.xml
just disable this mapset …
Still not working . Help me pls
Will the above work with a RPi zero?
yes, it will work with any Pi
I installed navit on pi4. Working very well
now i want to purchase a GPS dongle.
What kind of dongle do i have to buy ?
Is it possible to have a dongle GPS (us and galileo) compatible ?
Hi, I see a few people have changed it to MPH. Where do I put imerpial=”1″ as I don’t see a tag for it?
I’ve got it all working except starting when you boot the system, how have you done it?
gday mate, nice work. just wondering how i can config utc to nz time??
Thanks Kiwi GG
Stuffed around with Navit for ages until I found this page – thanks Auntie Google. Great work – thanks Mark.
What would you need to do to enable sound being emitted by the raspberry pi? Connect to car bluetooth somehow, or something else?
Do u know if it could work through an http interface , for accessing without a dedicated screen ?
So when I add the config for the raspberry pi official display, specifically the sections for display routing status and enable/disable routing information based on route status, my screen doesn’t refresh with the map showing. I just get a white screen with the name of the road I am on at the bottom and all the buttons.
If I remove the 2 sections of XML code for the routing staus, the map does refresh and show on the screen. It is a bit slow, but it does show.
Running this currently on a raspberry pi 2 B+, but in a couple days I will have the new hardware which will be a Raspberry Pi 4 with 2GB ram, so if this is a hardware limitation that may solve it. I should also note I am currently set up on my desk at home. I am getting GPS signal, so that shouldn’t be the issue.
So the Pi 4 was a HUGE improvement. One other thing I did whch I recommend is to purchase one of the Cepstral voices. The voice costed me $31.41, but the quality is leaps and bounds better than the espeak voice. Cepstral uses the swift engine for their voices. Install pulseaudio if you don’t already have it, and then in the navit.xml file look for the speech output section and for the speech tag data attribute use “padsp swift ‘%s'”.
Are there any GPS map navigation programs that work ‘out of the box’ so to speak, like the Windows programs I have had since 1993? The 2013 version of Windows Streets and Trips still works great. Just want something that will do the same thing with a Raspberry Pi 4.
Raspberry Pi 4 with BU-353S4 USB GPS unit
It doesn’t show current location.
Where do I set the default GPS unit in the config?
My PI has an HD 10.1″ screen. What settings to use to benefit from the 1920×1200 resolution?
I am unable to get navit to display the map and the position of the car. Raspberry pi 3B, latest raspberry pi OS(32 bit) Debian Bullseye 2021-10-30.
I did all of the recommended items:
Have GPS working
downloaded map – USA
loaded navit and espeak
edited navit xml file
changed center to my GPS location
put no for sample mapset, yes for openstreetmap – edited map path
The correct GPS coordinates appear in the Actions screen
The correct map binfile shows under settings/maps
I am able to plan a route, and see turn by turn directions
But no map display, or cursor to show the car location.
What am I missing? I would like to get this working!
Any solution by chance Jim? I’m running into the exact same scenario… All works splendid minus the most important part, the maps… I can get location, street name at the bottom, map file showing in the list and can search for streets. Still no visible maps/streets/cursor 🙁 – Any help greatly appreciated, on RPi4.
The issue lies with the debian package of navit which does not include all necessary files. A discussion on this topic can be found at https://github.com/navit-gps/navit/issues/1210.
I am unable to go ahead with the configuration setting change and save the file /etc/navit/navit.xml. i am able to see the file but when i try to save the file it gives me an error permission denied
can someone help me in this regard?
if you know a command or anyone i will be much appreciated
chmod command to change the permission for the file or directory. You can look online for the exact parameters depending on what and who you want to give access to !
Thanks for the great tutorial, it has helped me get my gps module working with my pi.
However I have run into an issue with displaying the icons.
I have downloaded the icons zip file and expanded it into the listed directory, but when I add the extra config to the navit.xml file nothing is displayed.
I am VNCing into my pi rather than it having its own screen, so could that be the reason why no icons are displayed and if so any idea on what changes I would need to make?