Create a standalone GPS system with offline maps
Hey Linux, Go Home
© Lead Image © Somyot Techapuwapat, 123RF.com
Use a low-cost GPS module and Navit to build a portable GPS system.
There are many places in the world where there is still no cellular or Internet access. Luckily, for only about $20 and around half an hour of time, you can create your own GPS system that can get you to those hidden camping spots and hiking trailheads.
Navit [1] is an open source car navigation system that includes a tool to create lightweight custom maps that can be used fully offline.
The hardware for this project does not need to be high-end. I had good results using both old Atom and i386 32-bit processors (Figure 1). I also tried using a Raspberry Pi 3, and it appeared to function fine. However, I found that a small 12" or 14" laptop was a better fit than a Rasp Pi, because I didn't need to worry about power or an external screen. You also have some choices on GPS modules, with a low-cost USB VK-162 module starting around $20.
In the following article, I outline the steps that I used to build an offline GPS system with some custom downloaded maps.
Connecting the GPS Module
After the USB GPS module is connected to your laptop, some communication will be seen on the attached port. For most systems, the connection will be on port /dev/ttyACMO. Activity can be checked with
$ cat /dev/ttyACM0
The output will look something like
$GPTXT,01,01,02,PROTVER 14.00*1E $GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20 $GPTXT,01,01,02,ANTSTATUS=OK*3B ...
If there is no output, check the GPS module's documentation, because it may not be operating at the default 9600 baud rate.
Once the GPS hardware is shown to be working, the next step is to install the GPS daemon and some client tools:
# Install GPS software on # Debian/Ubuntu/Rasp Pi sudo apt install gpsd gpsd-clients
GPS client tools such as gpsmon and xgps (Figure 2) will show satellite connections. For best results during the testing phase, ensure that your system is near a window.
After satellite connections are established, the next step is to install Navit:
# Install navit on Debian/Ubuntu/Rasp Pi sudo apt install navit
Navit will need some configuration changes. However, before you make those, you will want to create some offline maps.
Create Custom Maps
The Navit documentation lists a number of different map sources that can be used [2]. The easiest approach to building a map library is to use the OpenStreetMap website [3], which is perfect for creating small custom downloadable maps of rural and remote areas.
To create a custom map, either pan and zoom to the required location or use the search box. Once an area of interest is selected, the Export button will download a map.osm file to your local system (Figure 3).
Multiple maps can be exported and used in Navit, so it's recommended that each map be given a unique name. Note, the OpenStreetMap export option is limited to 5,000 nodes. To make larger maps, see the list of alternative tools and sites on the Export page.
Bash script files can also be used to generate maps using the OpenStreetMap API with GPS latitude and longitude positions (again with a 5,000 node limitation):
# Get OSM maps based on latitudes # and longitudes wget https://api.openstreetmap.org/api/0.6/map?bbox=min_long, min_lat, max_long, max_lat
The OSM maps are converted to small binary files via Navit's maptool utility:
# Convert OpenStreetMap files to a # Navit binary maptool -i custom_map1.osm mycustom1.bin
After the custom Navit binfiles are created, the final step is to update the Navit configuration file.
Navit Configuration
There is a wide range of options that can be toggled within the Navit application, but luckily only a few changes are required to get the basics working. To edit the Navit configuration file enter
sudo mousepad /etc/navit/navit.xml
First, you need to adjust the GPS location that the program initially opens to. For this, look for <navit center=, and then enter your approximate longitude and latitude. If this is not changed, the map will be centered in Germany. (Note, this is just an initial center position; in the future Navit will center on the last actual GPS reference).
To include your custom maps, look for the <mapset enabled= section. To remove error messages, I set all the original references to
<mapset enabled=no
then I included a new mapset with my newly created map files:
<mapset enabled="yes"> <map type="binfile" enabled="yes" data="mypath/mycustom1.bin"/> <map type="binfile" enabled="yes" data="mypath/mycustom2.bin"/> </mapset>
After the mapset section is updated, Navit can be run (Figure 4). Options such as searching for locations and setting up routes can be accessed by clicking on the Navit map.
Once the basic features are working, other additions such as 2D/3D views, audio output for directions, and car/bike/pedestrian modes can be set up.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Linux Kernel Project Releases Project Continuity Document
What happens to Linux when there's no Linus? It's a question many of us have asked over the years, and it seems it's also on the minds of the Linux kernel project.
-
Mecha Systems Introduces Linux Handheld
Mecha Systems has revealed its Mecha Comet, a new handheld computer powered by – you guessed it – Linux.
-
MX Linux 25.1 Features Dual Init System ISO
The latest release of MX Linux caters to lovers of two different init systems and even offers instructions on how to transition.
-
Photoshop on Linux?
A developer has patched Wine so that it'll run specific versions of Photoshop that depend on Adobe Creative Cloud.
-
Linux Mint 22.3 Now Available with New Tools
Linux Mint 22.3 has been released with a pair of new tools for system admins and some pretty cool new features.
-
New Linux Malware Targets Cloud-Based Linux Installations
VoidLink, a new Linux malware, should be of real concern because of its stealth and customization.
-
Say Goodbye to Middle-Mouse Paste
Both Gnome and Firefox have proposed getting rid of a long-time favorite Linux feature.
-
Manjaro 26.0 Primary Desktop Environments Default to Wayland
If you want to stick with X.Org, you'll be limited to the desktop environments you can choose.
-
Mozilla Plans to AI-ify Firefox
With a new CEO in control, Mozilla is doubling down on a strategy of trust, all the while leaning into AI.
-
Gnome Says No to AI-Generated Extensions
If you're a developer wanting to create a new Gnome extension, you'd best set aside that AI code generator, because the extension team will have none of that.

