Git Product home page Git Product logo

brouter's Introduction

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.

BRouter with Docker

To build the Docker image run (in the project's top level directory):

docker build -t brouter .

Download the segment files as described in the previous chapter. The folder containing the segment files can be mounted into the container. Run BRouter as follows:

docker run --rm -v ./misc/scripts/segments4:/segments4 brouter

This will start brouter with a set of default routing profiles.

If you want to provide your own routing profiles, you can also mount the folder containing the custom profiles:

docker run --rm -v ./misc/scripts/segments4:/segments4 -v /path/to/custom/profiles:/profiles2 brouter

Documentation

More documentation is available in the docs folder.

Related Projects

License

BRouter is released under an MIT License.

brouter's People

Contributors

abrensch avatar afischerdev avatar bagage avatar cpesch avatar devemux86 avatar erlkoenig90 avatar joe-akeem avatar midnightcomm avatar mincol avatar mjaschen avatar moving-bits avatar multimodaal avatar muthenberg avatar nrenner avatar ntruchsess avatar phyks avatar polyscias avatar poutnikl avatar quaelnix avatar radim-asamm avatar rkflx avatar simdens avatar stapawe avatar theraser avatar thomaswaldmann avatar totorrr avatar vodie avatar waldyrious avatar wladich avatar zod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brouter's Issues

cleanup distance calculation

3 issues with distance calculation in BRouter:

  • duplicate code ( 3 implemantions of public in calcDistance )
  • significant distance mismatch compared to other tools evaluating the tracks (earth radius?)
  • fails at lon = 180 degree

However, as distance calucation is called frequently within brouter, any cleanup also must obey the performance constraints

Online servers not running?

For both brouter.de/brouter-web and brouter-web-preview I get an net::ERR_CONNECTION_REFUSED with Chrome.

segments4 references update

Hi Arndt,

could you please update some references to segments4 with the following steps:

  • update server.cmd, see #53
  • update the standalone server scripts in your release zip template/preparation and check if the server.sh script then still has Unix line endings
  • update brouter-web index.html (link in "about"), see nrenner/brouter-web@f49178d

Validate custom profile on upload and send error to client

Currently, profile parsing is done in the RoutingEngine constructor (?). Errors are thrown as RuntimeException (IllegalArgumentException) and are not reported back to the client (catch Throwable in RouteServer.run).

I would like to parse a custom profile for validation right on profile upload and send an error message (if any) with the response.

  1. What would I need to do profile validation?
    Initialize a RoutingEngine? Are there any validations/checks afterwards?
    Can I call BExpressionContext.parse once or do I need to parse with different contexts as in RoutingEngine?
  2. Some exception messages might not be suitable for the client, e.g. readMetaData includes an getAbsolutePath(). Should we distinguish client and server error messages and e.g. have a custom ParseException with line and path members and custom getMessage/getClientMessage methods?

Tag smoothness

Is it possible to add tag smoothness to supported tags for ways?

Initial cost: introduce explicit classifier as trigger

the trigger for adding initial costs to a way section is a change in costfactor. This is why ferry distance cost is 5.67, not 5, just to make it a unique identifier.

That concept should be made explicit by introducing a classifier separated from the costfactor, to describe e.g. any non-paved way, a ferry, or steps.

Conditional evaluation of user profiles variables

BRouter evaluates terms of logical expressions conditionally , as well as the branches of if/switch commands.

OTOH, if I got it correctly when we talked about it in past, user defined variables are always evaluated, even if they occur only in expression branches unused for current way/node.

If not addressed yet, would be possible to implement conditional evaluation of variables as well ? As they are very useful to keep simplicity of code, but may cause profile performance decrease.

What about switching the paradigm from the variable based imperative one to macro based declarative one ? Assign would not be taken as assignment executive command for a variable, but as a declaration of macro expression.

Variable=Macro would be evaluated only when called for its value the first time. Then it would get expanded to ( macro expression code ) and its value would be stored for the eventual reuse for multiple occurences.

In such case, user variables would be evaluated only if used, what can increase performance of profile processing.

brouter-web configuration

Hi Arndt,

there is a new config.js in brouter-web that chooses the appropriate configuration for online or desktop at load time. The idea is that no customization is needed after updating (assuming the config file is kept up-to-date in the repo).

Have you made any other changes beside URL and profile list for the online service?
Should the new all.brf and softaccess.brf be included? The softaccess.brf gives me "does not contain expressions for context node".

Norbert

data file checksums

Currently no cross-checking is done on the integrity of the rd5 data files, so it's difficult to answer support questions for problems that could possible be caused by corrupted downloads or broken sd-cards.

Therefore at least some checksum stuff is neccessary to distinguish real bugs from bad data. Unfortunatly, the rd5-data-file format is not well designed and does not offser much space for downward-compatibel enhancements, but there's one place where data can be added without breaking old versions of brouter:

When initializing the data for a micro-cache, extra data can be added to what's delivered by OsmFile.getDataInputForSubIdx without breaking the node's decoding. Here, a checksum for that micro-cache's data can be placed.

Street names in navigation (OsmAnd)

Using BRouter as a service in OsmAnd 1.9.5 gives me excellent directions, but no street names. Do you happen to know in which software that limitation occurs (BRouter or OsmAnd)? Using the default router in OsmAnd gives me street names while navigating.

incline dependency of cost-functions

There's frequent demand on having profile scripts with different preferences for uphill-, downhill- and flat sections. Part of that is driven by the problem of really steep sections that just can't be managed with a bike. This problem is adressed in 1.0.1 to a certain extend by including the "incline" tag in the lookup table.

But some people wish to select fast surfaces for going dowhill, but prefer forest-tracks for going uphill. There's not yet a solution for that.

Solution would be to expose a new variable for the incline estimated from the SRTM data. However, there are some conceptual problems here, partly due to SRTM-Noise, but also due to the fact that adding more context to the profile-scripts reduces the cache-hit rate for the hash-cache that reduces the number of profile-evaluations.

However, just adding a 3-state variable (down/flat/up) to the context should be o.k. in terms of the cache-hit-rate. The challange here is to define a filter to calculate a meaningful value for that variable.

Confusing U-turn instruction

I was asked to forward the U turn versus Left U-turn + Right U-turn issue ( action 12 vs 13+14 ), related to
confusing-u-turn-instruction thread at Locus Helpdesk.
Locus users and the author have the opinion you may want to implement Left/Right U-turn actions, eventually review the sharp turn versus U-turn evaluation.

My understanding is sharp turn = 135 +- 22.5 degress, U-turn is 157.5..180 degress.
Perhaps such a U-turn versus Turn Around are to be distinguished, if possible.

travel time calculation

BRouter does not (yet) calculate travel times.

When used with OsmAnd, OsmAnds implicit "20km/h" for bikes is fine for me, but for car-routes, the implicit 60km/h is just a course guess and hust wrong for motorway trips.

Since BRouter's cost funtion is not based on speed, travel time calculations would require to create twins for the relevant terms in the routing profiles (costfactor, initialcost, turncost, ...) that deliver the estimated contribution to the travel time.

Simplest way to achieve that is to use separate files that are referenced from the profile-files that are processed by the same engine but deliver times in seconds instaed of costs and speeds instaed of costfactors.

timeout-free recalculation after nogo-changes

After changing the nogo-logic in the service-interface for immediate effect of changes in the coordinate source, the invalidation logic for the template track is wrong: it should be invalidated if a nogo-change is detected.

Break up long way sections by intermediate points

The waypoint matching first searches for nodes in a given area ( +- 1/8 degree= ca 10 km at max) around the waypoint and then searches for way sections starting at these nodes that come close to the wayoint to be matched.

This can fail if the way-segements (=connecting links between "non-trivial" nodes) are too long. This is not an issue for streets in urban areas, but for rivers, railways, motorways or hiking trails off the beaten track.

Solution will be to limit the lengh of these segments by changing some intermediate transfer nodes to network nodes.

separate concrete and concrete:plates / concrete:lanes

Hi,

The lookup seems to mash concrete, concrete:plates and concrete:lanes into one single thing
surface;0000212587 concrete concrete:plates concrete:lanes
It would be nice to have these separated, because concrete is pretty smooth and nice to bike on, while the plates and lanes are a major pain and slow down roadbikes significantly

Thanks for consideration

Export way ID's

It'd be great if there was a way to export way ID's of a route.
I'm writing my own mapping application, and using these ID's, I could draw ways that are part of a route differently, instead of drawing the route on top of it.

Addressing negative turncost

I was experimenting in past with negative turncost, initially on a user demand to promote winding to straight roads. It does the effect, but sometime brings problems.

I got occationally at Brouter-web "Error: error re-tracking track". It looked mysteriously until I realized at Data tab some very winding way segments got significant negative Turncost comparable with the way cost.
It could lead to the final cost < segment length, or perhaps even final cost < 0, what is forbidden.

Ensuring turncost >=0 for the same profile and route avoided the above error.

I have already previously posted it on Google group, but I put it here to keep track, as I got no response.

I suppose this should be addressed.

Either not to allow negative turncost,
Either (preferred) by internal clipping for total segment cost >=segment length.

The latter would still allow to have the winding preference, but would avoid routing error.

Access to angle information?

If I understand it correctly, it is possible to define a "turncost" variable in the routing profile, which in turn is used to calculate the cost of turns depending on the turn angle.

However, in city traffic, the angle itself is much more important, as it can be used to determine left turns and right turns which should be treated differently. Can I directly access this angle? In general, is there an exhaustive documentation of the routing profile?

Listed but ignored tag cycleway:right=*

It seems the BRouter standard TRekking profile ( and my profiles as well ) ignore cycleways in costfactor context, if they are marked as an additional tag for highway="mainroad" cycleway=, resp cycleway:=*.

These tags are listed in lookups.dat and BRouter-web data tab, e.g. cycleway:right=track,
but the tags seem to be ignored by the Trekking profile ( and by mine as well until now. )

It is a pity, as all data providing bike friendly hints are important.

The above may lead to improper full penalization of highway=primary with costfactor 3.0, while there should be probably 1.0 because of integrated cycleway. ( Inspired by a recent post to Brouter group )

fool proof installation

Installing BRouter is still complicated and people are asking for a click&pray installation from Google's play store.

Such an installation would require to obtain an installation of BRouter's service-mode to be, with datafiles for the relevant region downloaded and with a default routing-mode->routing-profile mapping in effect.

So it would be a modified APK with additional permissions for internet- and location-access doing all the downloads and installing all config files as well as the "traditional" APK without the extended permissions.

Avoid highway=construction

highway=construction is already in your lookup file, but the trekking profile does not check for it
Please add it, it is really unpleasant to end up on such way
Thank you

oneway:bicycle

Bicycle ways having a oneway:bicycle and a missing oneway are not treated as oneways.

For example here the direct route against the oneway:bicycle should not be taken, it would be better to route on the opposite cycle path:
http://brouter.de/brouter-web/#zoom=16&lat=50.93419&lon=6.97131&layer=OpenStreetMap&lonlats=6.971506,50.936621|6.971871,50.931478&nogos=&alternativeidx=0&format=geojson&profile=trekking

This assign statement should correct that.

assign oneway =
       if oneway=yes|true|1 then true
       else if oneway:bicycle=yes then true
       else if oneway= then junction=roundabout else false

Don't hide status bar

The warning about big amounts of data being downloaded is great. It usually makes me check my data connection.
Not easy when the status bar is not visible ...

--> don't hide status bar

Add more maxspeed tags

Could you please consider adding more maxspeed values:

maxspeed:conditional
maxspeed:forward
maxspeed:backward
maxspeed:motorcar

It would be really useful to have the maximum between all these and the normal maxspeed tag merged to the single maxspeed in the lookups.dat

Thanks

More reference-track invalidation issues

Bug if 2 nogo-areas exist for same location (with different radius):

  • if one is not veto'ed to create a reference-track, the other still cretes a veto for both, so at the time of a timeout-free recalc, a nogo is missing that was effective when creating the reference track. That also leads to invalidation of the refernce track.
  • if a profile is changed, reference tracks using this profile are not invalidated.

So there should be the nogo-name part of the key for the veto list, and checksum of the profile part of the reference track.

Next alternative button on route summary screen

Using the Android-App, alterative routes are calculated by running the calculation with the same parameters once more. This is time consuming for both entering the parameters and (for long distances) for the routing itself, since teh previous alternatives are calculated over and over again.

A "next alternative" button on the route summary page would help.

Downloads failing inside brouter android app

A week or two ago I have had in-app downloads of N10_N45.rd5 (and others) failing at around 33% completion due to timeout.

Using BRouter 1.4 from F-Droid on Android 4.4.4 with OsmAnd.

I was still able to download them manually from elsewhere and then adb pushing.

Include street names in rd5 files to make voice guidance better in OsmAnd

Hello,
wonderful piece of software! So far I seem to have found a way to actually use a software for road bike routing!

Back to topic. I use OsmAnd and use it for voice guidance most of the time. This would be so much better, if the street names were also spoken. I read that this is due to missing road names in the rd5 database.
Is there any chance that we might have a db that includes those, preferably as 2nd choice so that everyone who does not need them can save the space?
Best regards and greetings from Düsseldorf!
Rodja A.

add a warning feature (e.g. ferries)

When planning a route, there may be sections in the routing result that require attention (e.g. a ferry).

A new expression for the profile parser:

warn

with being displayed in the calculation summary if that expression contributed to the final routing result would by a generic way to achieve that

Custom/Alias navigation modes

It may be useful for future hosting applications to consider implementation of alias or custom modes for Brouter mode-profile mapping.

Partially for bicycle and definitely for foot routing, the current schema car/bicycle/foot fast/short is confusing and misleading, if Brouter is used as the 3rd party local routing engine.

As talked with the LocusMap author, the direct consequence is the application uses just one Brouter foot mode - the shorrt one AFAIK.

Users of eventual future alias/custom mode aware applications would be able to select from a bunch of self-explaining modes ( if profiles abstraction layer is to be kept ).

Applications not alias/custom mode aware would use standard modes as usually.
Applications alias/custom mode aware could use the exposed alias/custom names as well.

Predefined names could be prepared in cooperation with hosting application developers.

My idea is to implement one of or both partially independent ideas.

ALIAS modes, mapped to current modes, like
 ALIAS mode  --> Brouter navigation mode --> Brouter profile 

* Trekking Good Weather --> Bicycle short --> Trekking Dry.brf
* Trekking Bad Weather --> Bicycle fast --> Trekking Wet.brf
* Walking --> Foot fast --> Walking.brf
* Hiking --> Foot short --> Hiking.brf

The ALIASes could be either predefined, either custom ( Advanced used could edit the config file ).

CUSTOM modes, mapped directly to profiles aside of standard modes., like
 CUSTOM mode --> Brouter profile 

* Trekking Fast --> Trekking Fast.brf
* Trekking MTB --> Trekking MTB Light.brf
* Walking --> Walking.brf
* Hiking --> Hiking.brf
* Mountain Hiking --> Demanding Mountain Hiking.brf

brouter can't traverse a bridge

I've run into a way that brouter should traverse, but won't, with the fast-bike profile while trying to find a cycling route from Portland, Oregon to a trailhead in Washington State (just trying out brouter). It's causing an epic reroute through different counties.

I'm assuming it's either

  • an error in the OSM data,
  • or some complication in the OSM data which is confusing brouter.

Here is a simple test case with the start and end on either side of the problem way (OSM), with car-test profile:

screen shot 2015-08-26 at 2 58 41 pm

and with bike-fast profile:

screen shot 2015-08-26 at 2 59 03 pm

The bridge is one-way for car traffic and has a bike lane going the other way. Bikes going with the direction of car traffic are supposed to ride in the lane.

bike routes: evaluate network tag

The Map.Creator evaluates bike relations by just looking for route=bicycle ( see OsmCutter.nextRelation() )

Though these are mostly the national and regional cycle networks (e.g. network = ncn ), there exists other networks ( e.g. network=radweit ) that have a different characteristic but also lead to tagging the way as a long-distance-cycle-way.

Todo here is at least to filter the cycle-routes for the relevant networks

add 4wd_only tag to lookups.dat

Hi team,

Brouter is awesome :-)

I'm using the web version of Brouter for offroad 4wd track routing, and unlike most other modes of transport we active seek out poor quality roads.

I see you expose tracktype, smoothness and surface via lookups.dat - but would it be possible to also add the 4wd_only tag?

This tag is used quite a lot, particularly in Australia where it is used as a standalone (tracktype, smoothness and surface not set)
http://wiki.openstreetmap.org/wiki/Tag:4wd_only%3Dyes
http://taginfo.openstreetmap.org/tags/4wd_only=yes#map

Thanks in advance...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.