The idea behind a route planner is to calculate a suitable route between two geographical points, the start and the end point. The basis for a route planner consists of a database populated with data about specific routes and their relevant characteristics.
Ideally, searching the database should occur with minimal compute time and result in the most efficient route that is also the shortest or fastest. There may be additional search criteria to consider, such as mode of transportation, route characteristics, type and condition of route, plus specifics about the time of day and the season of the year when the route is to be used.
All of the providers who offer maps and navigational systems also offer matching online services and software. Frequently, there are also accompanying apps for smartphones. The providers offering these products and services include Falk, ViaMichelin, TomTom, Nokia/Map24, and Google Maps, among others. As it turns out, free route planners compete nicely with commercial providers in terms of variety and quality. In some instances, the free planners actually perform even better.
The online tools OpenStreetMap [1], Open Source Routing Machine (OSRM) [2], GraphHopper [3], and BBBike [4] have created an excellent reputation for themselves. There are also offline programs that let the user navigate independently of the Internet and therefore without access to data from a server (see the "Everything Online" box). These programs include Navit [5], OsmAnd [6], OpenStreetMap for Android [7], and Routino [8].
Everything Online
It is a good idea to store maps and route information online and also retrieve them from there if needed, because the data volume involved can be significant. You can often get by with just a portion of the maps and route data that is offered. If needed, you can later load an additional portion of the data or missing pieces.
The project describes Routino as software that specializes in finding routes between locations on the basis of topographical information contained in the OpenStreetMap (OSM) project. The software calculates the shortest or the quickest path. For its calculations, Routino uses a specially adapted database that divides individual parts of a path into segments, which are then grouped together according to similar characteristics.
After setting up the program (see the "Installation" box), you will still need map content as OSM data. The Geofabrik [9] website is ideal for browsing for this kind of content. Once you have loaded the content you want, use planetsplitter to process the maps. This tool comes as part of the Routino package.
Installation
You will find all of the packages necessary for Routino in the official repositories for Debian and Ubuntu. These include routino (route computer, command-line tool), routino-common (data for Routino), plus libroutino0 and libroutino-slim0 (routing libraries). In addition, you will need routino-www and javascript-common , as well as a web server like Apache(apache2 ) or Nginx (nginx ) for the web interface and browser display.
We have chosen the map content for the Western US, which you can find on Geofabrik in the us-west-latest.osm.bz2 file. Use the prefix usw with planetsplitter to be able to differentiate the files you have chosen from any future maps you'll use:
$ planetsplitter --prefix=usw us-west-latest.osm.bz2
This will take awhile, maybe hours, but when it is done, you will be rewarded with four files: usw-nodes.mem , usw-relations.mem , usw-segments.mem , and usw-ways.mem . This shrinks the original 2GB of compressed data to about 1.5MB. Figure 1 shows an excerpt of the extensive output during processing.
This is sufficient for calculating routes via the command line. If instead you use the application via the web interface, then, as administrator, you should copy the four files that are created to the /var/lib/routino/data/ directory. With Debian and Ubuntu, it is important to make sure that individual files get copied [10] without a prefix. The simplest approach is to rename the four files once they are in the target directory.
Routino calculates routes for all of the main modes of transportation. Obvious variants available for the profiles include automobile, pedestrian traffic, bicycle, motorcycle, and truck. In addition, you will also find variants like horse, wheelchair, and local public transport.
You can also specify a preferred roadway type. Moreover, the program takes the presence of one-way streets into account, limits on loads and the size of a vehicle, barriers, and restrictions on turning directions. The same goes for other characteristics like the roadway conditions and speed limits.
You should use the call from Listing 1 if you want to calculate the shortest path between two points. The --dir parameter is used for naming the directory with the routing data and the --transport parameter for the selected means of transport. The --shortest button is used to indicate that you want the software to find the shortest route.
Listing 1
Calculating Route
$ routino-router --dir=/var/lib/routino/data --transport=motorcar --shortest --lon1=-121.923498 --lat1=36.623598 --lon2=-121.850284 --lat2=36.587442 --language=en --output-html Loaded Files: nodes, segments, ways & relations Found Closest Point: Waypoint 1 Waypoint 1 is segment 6482339 (node 5640986 -> 5641028): -121.923410 36.623722 = 0.015 km Found Closest Point: Waypoint 2 Waypoint 2 is node 5974815: -121.850554 36.587151 = 0.040 km Routing from waypoint 1 to waypoint 2 Found Start Route: Nodes checked = 3 Found Finish Route: Nodes checked = 4 Found Middle Route: Super-Nodes checked = 4071 Found Combined Route: Nodes = 133 Routed OK Generated Result Outputs
Routino also requires two pairs of coordinates for latitude and longitude, lon1 /lat1 and lon2 /lat2 .
The --language parameter determines the language that is used to describe the route. If no language has been indicated, the output will be generated in English. Specifying --output-html generates a file by the name of shortest.html . Figure 2 shows the recommendation together with a map where the route is outlined. In this case, we are looking at the route between 108 Lighthouse Avenue in Pacific Grove, Monterey, and Monterey Airport.
To access the web interface for the program, you have to install the routino-www package first:
sudo apt install routino-www
This will install also the Apache web server (if you don't already have it) and some other dependencies. The contents of the Routino web are in /usr/share/routino/www , and you should make them accessible for the Apache web server with:
sudo chown -R www-data:www-data /usr/share/routino/www
In theory, you should now be able to visit http://localhost/routino with your browser and see the map information, but if you open the address, you'll see controls on the left of the window, but a blank space where the map should be on the right.
Turns out the program cannot find an essential component, leaflet.js , a library that reads and graphically shows map data. Download it from [11] and unzip it to /var/www/html/javascript/leaflet . You will have to do this as root, which means you will again have to make the contents accessible for the server before everything works correctly:
sudo chown -R www-data:www-data /var/www/javascript
The final step is to make sure Apache understands and executes correctly the Perl-rich pages Routino generates to show the results – which is something else that is messed up in the web interface in Ubuntu.
The first thing you have to do is make sure the /etc/routino/apache.conf looks like what you see in Listing 2.
Listing 2
/etc/routino/apache.conf
Alias /routino /usr/share/routino/www <Directory /usr/share/routino/www> AddHandler cgi-script .cgi LanguagePriority en ForceLanguagePriority Prefer Fallback Options +ExecCGI AllowOverride None Require ip 127.0.0.0/255.0.0.0 Require host localhost <FilesMatch .*\.pl$> Require all denied </FilesMatch> </Directory>
You can comment out the lines
Require ip 127.0.0.0/255.0.0.0 Require host localhost
so they look like this:
#Require ip 127.0.0.0/255.0.0.0 #Require host localhost
Because then you will be able to access the web interface from any device on your local network rather than just from the machine on which the program is running.
In the next step, open the /usr/share/routino/www/results.cgi file and change the line that says
require "router.pl";
to
require "/usr/share/routino/www/router.pl";
Save and close the file.
You have to do the same with the /usr/share/routino/www/router.cgi and change the line that says
require "router.pl";
to:
require "/usr/share/routino/www/router.pl";
In /usr/share/routino/www/router.pl , you have to change the line
require "paths.pl";
to:
require "/usr/share/routino/www/paths.pl";
And the line that says
require "profiles.pl";
to:
require "/usr/share/routino/www/paths.pl";
Finally, in /usr/share/routino/www/statistics.cgi , change the line
require "paths.pl";
to:
require "/usr/share/routino/www/paths.pl";
Once you're done with the changes, you can restart the Apache web server:
sudo systemctl start apache2
Then, visit http://localhost/routino and start planning your trips. Figure 3 shows what the web interface looks like once it is working.
You will find the navigation function on the left side of the interface and the results on the right. Settings include options for the interface language, a maximum of nine route points, transportation method, conditions along the route, and the type of use.
However, we were unable to get the green line that marks the shortest route between the points or the blue line that represents the fastest. These lines do show up on the demo site at [12]. However, if you float the cursor over the directions on the left, a circle will show up on the map showing where you should be.
Pressing the left mouse button lets you move the map section. In order to recalculate the route, you should first move the corresponding point on the route and then click either on the Shortest route button or on Fastest route .
You will find the results for the route, the appropriate GPX track, various route descriptions, and also the corresponding coordinates on the Results tab. Routino uses the Data tab to reference the database that has been used. This means that Routino provides information on the number and size of the nodes and also the stored segments.
The times calculated by Routino for the route should be taken with a grain of salt. Figure 2, for example, shows that Routino indicates that the nearly 10 kilometers between Pacific Grove and the Monterey Airport in California requires seven minutes. In reality, this amount of time only applies when the road is empty of all other traffic, all lights are green, and the maximum permissible speed is maintained.
Uwe Steinmann is the developer behind the software. He himself admits that the time indications are optimistic and that the program does not take traffic volume into account. Routino derives the travel speed solely from the type of roadway. Since calculations have been done offline purely according to distance, the speed factor appears to play a subordinate role [9].
For daily use, Routino shows itself to be very quick and reliable. However, you should keep in mind that the validity of this observation is based on a number of variables, including the OSM files that have been loaded to the database and the section of the map that is selected. For regions that are less well mapped, the program delivers quite meager results. For urban areas that have been mapped out in detail, the software generates reliable routes. The functional design and the ease of use for the tools make a positive impression. This is one of the reasons that the program QMapShack utilizes the tools for local calculations.
Infos