Create a standalone GPS system with offline maps

Hey Linux, Go Home

© Lead Image © Somyot Techapuwapat, 123RF.com

© Lead Image © Somyot Techapuwapat, 123RF.com

Article from Issue 300/2025
Author(s):

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.

Figure 1: A Navit car navigation system loaded on an old 12" laptop.

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.

Figure 2: Satellite connections can be verified with GPS client tools such as xgps.

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).

Figure 3: Use the OpenStreetMap site to create custom map files.

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.

Figure 4: The Navit screen and the options page.

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

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • CeBIT Open Source Project Lounge Exhibit Space Winners Selected

    The CeBIT Open Source project lounge which is part of CeBIT Open Source called for projects to apply for free exhibit space. A jury has now selected and announced the fifteen free, non-commercial projects that will receive exhibit space at CeBIT for free.

  • Share Locations with OpenStreetMap
  • Potlatch 2

    If you need a tool to make minor modifications in OpenStreetMap, Potlatch 2 is a useful choice as a fast and easy-to-use editor.

  • uMap

    uMap provides an easy way to create advanced maps based on the OpenStreetMap service. This article explains how to put uMap's features and functionality to practical use.

  • Cache

    OpenStreetMap volunteers map post-earthquake Haiti, and Free Linux Box finds happy homes for donated Linux machines.

comments powered by Disqus
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.

Learn More

News