configurable OSM offline router with elevation awareness, Java + Android
Find a file
Henrik Fehlauer 82fecf95f6
Revert voice hint indexing change in JSON API to restore compatibility
a9e8731 made voice hints available from `formatAsGeoJson()`, which is
used both in the GeoJSON HTTP API and in the JSON Java API. To indicate
a specific type of voice hint, it was chosen to include its numeric id
in the output JSON array among other data. The full list of available
ids was defined in `class VoiceHint`, e.g. `static final int C = 1;`.

Consumers of the API now depended on the mapping from id to intended
voice hint not changing, since otherwise incorrect voice hints could be
displayed. Unfortunately that API contract was broken in c9ae7c8, where
instead of assigning unused ids to new commands, the meaning of existing
ids was changed. This broke compatibility: Clients adapted to the change
did not work with the old indexing anymore, and clients not yet adapted
would break with newer BRouter releases, e.g. they would suddenly
display "Off route" for a "right u-turn".

To restore compatibility, the indexing is reverted to its old state.

This will unbreak GeoJSON/JSON API users no yet adapted to BRouter 1.7.0
or 1.7.1, e.g. BRouter-Web as well as unmaintained clients. While API
users which already patched ids would need to undo or special-case their
changes, the impact is believed to be low, as no such users are
currently known and the breakage was released only recently.

The changed meaning of `TU` in output formats (before: `u-turn-left`,
now: `u-turn-180`) has not been reverted for now, since either that
command is mapped to fallback solutions anyway (e.g. Orux, old Locus,
Gpsies), the change has already been implemented in clients (new Locus,
Cruiser) or was only planned to be implemented in the future (OsmAnd).

Fixes #584

Test Plan:
  - `./gradlew test`
  - Run BRouter with an unpatched BRouter-Web and confirm voice hint
  ids have been restored to the same ones as emitted by BRouter 1.6.3.
2023-07-11 17:57:14 +00:00
.github/workflows Update gradle-publish.yml 2023-07-12 12:05:34 +02:00
brouter-codec Enable PMD rule PrimitiveWrapperInstantiation and fix violations 2023-05-09 23:11:14 +02:00
brouter-core Revert voice hint indexing change in JSON API to restore compatibility 2023-07-11 17:57:14 +00:00
brouter-expressions update test lookup with estimated_*_class 2023-07-08 11:33:38 +02:00
brouter-map-creator changed db-tag-processing to csv-file 2023-07-09 15:39:55 +02:00
brouter-mapaccess give a second chance when wpt not found 2023-07-08 09:56:40 +02:00
brouter-routing-app add a silent mode for app start 2023-07-10 12:00:01 +02:00
brouter-server Update build.gradle 2023-07-12 13:01:59 +02:00
brouter-util Enable PMD rule PrimitiveWrapperInstantiation and fix violations 2023-05-09 23:11:14 +02:00
config Enable PMD rule PrimitiveWrapperInstantiation and fix violations 2023-05-09 23:11:14 +02:00
docs Merge pull request #588 from afischerdev/new-apk 2023-07-12 11:47:57 +02:00
gradle/wrapper gradle updates 2023-03-14 14:14:59 +01:00
misc update consider description 2023-07-08 11:20:03 +02:00
.editorconfig Stricter whitespace handling 2022-11-09 07:29:53 +01:00
.git-blame-ignore-revs Ignore reformatting in git blame 2022-07-25 06:15:41 +02:00
.gitignore android 11 part 1 2021-07-24 11:49:29 +02:00
build.gradle new version 1.7.1 2023-07-10 18:18:10 +02:00
gradle.properties gradle updates 2023-03-14 14:14:59 +01:00
gradlew Switched build system to gradle 2020-05-24 16:46:04 +02:00
gradlew.bat Switched build system to gradle 2020-05-24 16:46:04 +02:00
LICENSE MIT license 2019-05-04 20:04:56 +02:00
README.md Merge branch 'master' into docs 2022-05-17 06:40:31 +02:00
settings.gradle Avoid error messagesav 2021-07-01 12:46:43 +02:00

BRouter

BRouter is a configurable OSM offline router with elevation awareness, Java + Android. Designed to be multi-modal with a particular emphasis on bicycle and energy-based car routing.

For more infos see http://brouter.de/brouter.

BRouter on Android

You can install the BRouter app on your Android device from F-Droid or Google Play Store. You can also build BRouter yourself. You can find detailed documentation of the BRouter Android app in docs/users/android_quickstart.md.

Get it on F-Droid Get it on Google Play

Android with Locus

You can use BRouter as the offline routing engine for Locus Map on your Android device. This is currently the most featureful and maintained solutions for using BRouter on your Android device.

A full documentation on how to set this up is available at https://www.locusmap.eu/locus-map-can-navigate-offline/.

Android with OSMAnd

Alternatively, you can also use BRouter as the offline routing engine for OSMAnd on your Android device.

A full documentation on how to set this up is available at docs/users/osmand.md.

BRouter on Windows/Linux/Mac OS

Build and Install

To compile the BRouter Android app, the Android SDK path must first be set in a file called local.properties in the main folder:

sdk.dir=<your/android/sdk/path>

Build BRouter with the Android app (if Android SDK path is set):

./gradlew clean build

Build BRouter without the Android app:

./gradlew clean build -x :brouter-routing-app:build

Build JAR file for server and map creator with all dependent classes:

./gradlew clean build fatJar # places JAR file in brouter-server/build/libs/

Build ZIP file for distribution with readmes, profiles, APK and JAR:

./gradlew distZip # places ZIP file in brouter-server/build/distributions/

Get the required segments (data) files

Routing data files are organised as 5*5 degree files, with the filename containing the south-west corner of the square, which means:

  • You want to route near West48/North37 -> you need W50_N35.rd5
  • You want to route near East7/North47 -> you need E5_N45.rd5

These data files, called "segments" across BRouter, are generated from OpenStreetMap data and stored in a custom binary format (rd5) for improved efficiency of BRouter routing.

Download them from brouter.de

Segments files from the whole planet are generated weekly at https://brouter.de/brouter/segments4/.

You can download one or more segments files, covering the area of the planet you want to route, into the misc/segments4 directory.

Generate your own segments files

You can also generate the segments files you need directly from a planet dump of OpenStreetMap data (or a GeoFabrik extract).

More documentation of this is available in the docs/developers/build_segments.md file.

(Optional) Generate profile variants

This repository holds examples of BRouter profiles for many different transportation modes. Most of these can be easily customized by setting variables in the first global context of the profiles files.

An helper script is available in misc/scripts/generate_profile_variants.sh to help you quickly generate variants based on the default profiles, to create a default set of profiles covering most of the basic use cases.

Have a look at the docs/developers/profile_developers_guide.md for an in-depth guide on profiles edition and customization.

Run the BRouter HTTP server

Helpers scripts are provided in misc/scripts/standalone to quickly spawn a BRouter HTTP server for various platforms.

  • Linux/Mac OS: ./misc/scripts/standalone/server.sh
  • Windows (using Bash): ./misc/scripts/standalone/server.sh
  • Windows (using CMD): misc\scripts\standalone\server.cmd

The API endpoints exposed by this HTTP server are documented in the brouter-server/src/main/java/btools/server/request/ServerHandler.java file.

Documentation

More documentation is available in the docs folder.

License

BRouter is released under an MIT License.