Skip to content
Branch: master
Find file History
karussell Introduce RoadClass, RoadEnvironment, CarMaxSpeed, Surface, Toll and …
…more EncodedValues (#1548)

* initial commit with more TagParsers and PathDetails

* added a bunch of helpful EncodedValues: RoadClass, RoadEnvironment, ... and make TagParser better separated but easy to add via GHUtility.addDefaultEncodedValues

* store and load EncodedValues

* make new path details working

* minor test fix

* make default encoded values accessible from config.yml

* add toll and a simple AvoidWeighting incl. tests

* make more tests pass and include destination access in DataFlagEncoder

* share SpatialRule stuff too; make TagParser creation pluggable; replace SpatialRule.Access with RoadAccess

* added a few license headers

* fix a few TODO NOWs; car max speed is 0 for unknown and 140 for unlimited - we might change this

* fixed bug in EncodingManager.toEncodedValuesString; separated max_width, max_weight, max_height; differentiate between shared and FlagEncoder-bound EncodedValues to avoid loading them

* make country path detail working

* fix bug in path details

* use more natural max_speed instead of car_max_speed, later we could still add truck_max_speed

* rename class too

* include default value in decimal list

* using EnumEncodedValue instead of ObjectEncodedValue for better type safety

* introduced default value for FactorizedDecimalEncodedValue; improved comments and deprecated MappedDecimalEncodedValue for now

* default for RoadAccess is now YES

* forestry is not a highway. but bridleway is and is important

* removed AvoidWeighting

* removed MappedDecimalEncodedValue

* removed defaultValue from DecimalDetails for consistency

* use destination as default for track in Germany and forestry for Austria

* merged master

* fixed toll toll order bug

* use speed==150 as unlimited as it can be returned exactly also if factor is 5, 3, 2 and 1

* allow setReverse only if storeBothDirections==true

* return -1 instead of string 'infinity'

* a bit clean up

* remove forestry, add bridleway to RoadClass

* moved the test back to its old location

* rename property from storeBothDirections into storeTwoDirections (similar to speed_two_directions for CarFlagEncoder)

* minor fix

* make maxspeedparser a bit stricter

* remove motorroad which is mostly a trunk with special access

* minor cosmetics

* include maximum value for EncodedValue to avoid another try-catch when parsing

* remove IndexBased from description

* improved javadoc a bit

* further refinements
Latest commit 4e143c4 Jun 14, 2019

README.md

GraphHopper GTFS

Here is a screenshot of a public transport query. The route with the earliest arrival time is highlighted in green. The three non-highlighted alternatives have fewer transfers. They include a walk-only route (no vehicle boardings at all).

gtfs preview

Quick Start

git clone https://github.com/graphhopper/graphhopper
cd graphhopper
# download GTFS from Berlin & Brandenburg in Germany (VBB) and the 'surrounding' OpenStreetMap data for the walk network
wget -O gtfs-vbb.zip http://transitfeeds.com/p/verkehrsverbund-berlin-brandenburg/213/latest/download
wget http://download.geofabrik.de/europe/germany/brandenburg-latest.osm.pbf
./graphhopper.sh build
# The following process will take roughly 5 minutes on a modern laptop when it is executed for the first time.
# It imports the previously downloaded OSM data of the Brandenburg area as well as the GTFS.
java -Xmx8g -Xms8g \
  -Dgraphhopper.datareader.file=brandenburg-latest.osm.pbf \
  -Dgraphhopper.gtfs.file=gtfs-vbb.zip \
  -Dgraphhopper.graph.flag_encoders=pt \
  -Dgraphhopper.prepare.ch.weightings=no \
  -Dgraphhopper.graph.location=./graph-cache \
  -jar web/target/graphhopper-web-*.jar server config.yml
# view the web UI e.g. via:
firefox http://localhost:8989

Graph schema

Graph schema

We see three trips of two routes (top to bottom: route 1, route 1, route 2) and three stations (colored groups). The ENTER_TEN and LEAVE_TEN edges are the entry and exit to the time expanded network proper. They enforce that you are put on the correct node in the timeline when searching forward and backward, respectively. The STOP_ENTER and STOP_EXIT nodes are regular, spatial nodes which can be connected to the road network.

The BOARD edge checks if the trip is valid on the requested day: Our graph is "modulo operating day", but a pure time expanded graph which is fully unrolled is also possible. Then that check could go away. It also counts the number of boardings.

The TRANSFER edge ensures that the third departure is only reachable from the first arrival but not from the second one.

You can’t perform that action at this time.