trafficpixels Blog

Questions? Suggestions? message me
previous -- actual -- next

Mon 2024-05-20

Brouter add tag for wheelchair routing


I try to build a basic BRouter routing profile for creating routes suitable for use with wheelchairs. This profile should avoid high kerbs. So OpenStreetMap nodes with the tag kerb=raised, should be avoided.
In order to consider a new tag like kerb=raised, it must be included in /brouter/profiles2/lookups.dat in the ways or node segment. After a tag is added to this file, the rd5 map files must be rebuilt. Phyks has described this process. I just found this out and have not yet tried it. Update: it does no longer work like this. See my next post below for a solution.
Next this tag can be used in a BRouter profile. The next statement in the node context of a profile would treat a raised kerb like a 500 metre and traffic signals like a 30 metre stretch of an ideal path.
assign initialcost 
if ( kerb=raised ) then 500
else if ( highway=traffic_signals ) then  30
else
switch or bikeaccess footaccess 0 1000000

You can read more about how to consider tags on nodes in a profile in one of my previous posts.

Build .rd5 routing file for BRouter from .pbf file

I assume that the following code examples are run in a Linux terminal. I use a 64 bit Debian 12 operating system and openjdk 17.0.11 for running Java bytecode on an X86 Acer Aspire 5742 laptop manufactured in 2009 with 240 GB SSD and 4 GB ram.
  1. Download the BRouter source code. Open a terminal, create a new folder and navigate to it
    mkdir brouter
    cd brouter
    To download the most recent code execute git clone https://github.com/abrensch/brouter.git. You might have to install git first.

    Alternatively download and unzip the code fom 2024-05-30 from my website [2.1 MB]

    wget --continue https://trafficpixel.tk/share/2024/brouter/brouter_source-2024-05-30.zip
    unzip brouter_source-2024-05-30.zip
    mv brouter-master brouter
  2. Compile BRouter without the app. You need to have installed Java. Check if you have installed Java: java -version if it says command not found then you have to install Java first.
  3. Switch the folder cd brouter/ then start compiling. This needed 3.5 minutes on my laptop. ./gradlew clean build fatJar
  4. Download an extract of OpenStreetMap data in .pbf format from Geofabrik, for example Liechtenstein (because it is small and fast to process). You can also merge multiple pbf files.
    cd misc/scripts/mapcreation/
    wget --continue https://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf
    rename the file to planet-latest.osm.pbf mv *.osm.pbf planet-latest.osm.pbf
  5. The supplied script process_pbf_planet.sh does not work properly because some programs it uses changed and now expect different file name extensions. I changed the script a bit. It copies files and uses more storage but at least it works. Download my adapted script. wget https://trafficpixel.tk/share/2024/brouter/process_pbf_planet_2024-06-09.sh This step can be skipped if you already downloaded it earlier.
  6. start the script and start the map creation sh process_pbf_planet_2024-06-09.sh
  7. After some time if no error occurs the resulting E5_N45.rd5 files is in the directory tmp/segments.
  8. If you want to change the lookups.dat file, change the file at brouter/misc/profiles2/lookups.dat. After that you can run the map creation script. Finally copy the changed lookups.dat file to the profiles2 folder on your server, computer or smartphone and the resulting .rd5 files to the segments4 folder.. The lookups.dat file currently contains 2 non-UTF8 characters. This can lead to errors when editing the file. You can download a corrected version from my server
    cd ../../profiles2 #changes 2 folders up, then to profiles2 directory
    mv lookups.dat lookups.dat.bak #saves a backup of the current lookups.dat file at lookups.dat.bak
    wget https://trafficpixel.tk/share/2024/brouter/lookups.dat #downloads corrected file
    cd ../scripts/mapcreation #changes back to mapcreation directory

How to install git in Debian based systems

How to install java in a Debian based system

How to merge multiple pbf files

How to install osmium in Debian based systems