You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To learn about all available encoded values you can query the `/info` endpoint.
81
+
82
+
To learn about all available encoded values you can query the `/info` endpoint
76
83
77
84
Besides this kind of categories, which can take multiple different string values, there are also some that represent a
78
-
boolean value (they are either true or false for a given edge), like:
85
+
boolean value (they are either true or false for a given road segment), like:
79
86
80
87
- get_off_bike
81
88
- road_class_link
89
+
- roundabout
90
+
- with postfix `_access` contains the access (as boolean) for a specific vehicle
82
91
83
92
There are also some that take on a numeric value, like:
84
93
85
-
- max_speed
86
-
- max_weight
87
-
- max_height
88
-
- max_width
94
+
- average_slope: a decimal for "elevation change" / edge_distance for a road segment; it changes the sign in reverse direction; see also max_slope
95
+
- curvature: "beeline distance" / edge_distance (0..1) e.g. a curvy road is smaller than 1
96
+
- hike_rating, horse_rating, mtb_rating: a number from 0 to 6 for the `sac_scale` in OSM, e.g. 0 means "missing", 1 means "hiking", 2 means "mountain_hiking" and so on
97
+
- lanes: number of lanes
98
+
- max_slope: an unsigned decimal for the maximum slope ("elevation change / distance_i") of an edge with `sum(distance_i)=edge_distance`. Important for longer road segments where ups (or downs) can be much bigger than the average_slope.
A weighting allows to create a "weight" for an edge. The weight of an edge reflects the cost of travelling along this edge.
3
+
Instead of creating a new Weighting implementation is is highly recommended to use the CustomWeighting instead, which is explained in
4
+
the [profiles](profiles.md) and [custom models](custom-models.md) section.
5
+
6
+
A weighting allows to create a "weight" for an edge. The weight of an edge reflects the cost of travelling along this edge.
4
7
All implementations of [RoutingAlgorithm](https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/RoutingAlgorithm.java)
5
-
in GraphHopper calculate the shortest path, which means the path with the [lowest overall cost from A to B](https://en.wikipedia.org/wiki/Shortest_path_problem).
6
-
The definition of the cost function is up to you, so you can create a cost function (we call this weighting) for the fastest path.
7
-
GraphHopper will still calculate the path with the lowest cost, but you can define the cost as a mix of distance speed, as shown in the [FastestWeighting](https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/weighting/FastestWeighting.java).
8
+
in GraphHopper calculate the shortest path, which means the path with the [lowest overall cost from A to B](https://en.wikipedia.org/wiki/Shortest_path_problem).
9
+
The definition of the cost function is up to you, so you can create a cost function (we call this weighting) for the fastest path.
10
+
GraphHopper will still calculate the path with the lowest cost, but you can define the cost as a mix of distance speed, as shown in the
In order to create a custom weighting you need to do the following:
10
14
11
-
1. Implement the Weighting class
12
-
2. Create a subclass of GraphHopper and override `createWeighting`
13
-
14
-
Or use the CustomWeighting feature explained in [profiles](profiles.md).
15
+
1. Implement the Weighting class and the WeightingFactory
16
+
2. Let the GraphHopper class know about your WeightingFactory via overriding createWeightingFactory
15
17
16
18
### Implement your own weighting
17
19
@@ -23,26 +25,4 @@ a sample can be found in the [AvoidEdgesWeighting](https://github.com/graphhoppe
23
25
If your weights change on a per-request base, like the [BlockAreaWeighting](https://github.com/graphhopper/graphhopper/blob/bbd62fded97be060fc09177f9fae794cea284554/core/src/main/java/com/graphhopper/routing/weighting/BlockAreaWeighting.java),
24
26
you cannot use the 'speed mode', but have to use the 'hybrid mode' or 'flexible mode' (more details [here](https://github.com/graphhopper/graphhopper#technical-overview)).
25
27
If you haven't disabled the 'speed mode' in your config, you have to disable it for the requests by appending `ch.disable=true`
26
-
in the request url.
27
-
28
-
### Extend GraphHopper
29
-
30
-
For general information on how to extend GraphHopper have a look [here](low-level-api.md).
31
-
32
-
Extending GraphHopper is easy, just need to override the `createWeighting` method of the GraphHopper class.
33
-
We return a new instance of our custom weighting if the string `my_custom_weighting` is given. Otherwise let the super class handle it:
Copy file name to clipboardExpand all lines: docs/index.md
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -49,14 +49,13 @@ Various topics are explained in more detail separately:
49
49
50
50
*[Technical overview](./core/technical.md): Technical details about how GraphHopper its calculations are working.
51
51
*[Custom models](./core/custom-models.md): This tutorial explains how to customize an existing vehicle profile to your needs without to know Java.
52
+
*[Create custom weighting](./core/weighting.md): Documentation regarding Weighting. In almost all situations a custom model should be created instead.
52
53
*[Simple routing](./core/routing.md): Tutorial how to integrate GraphHopper in your Java application (or pick any JVM language)
53
-
*[Create custom weighting](./core/weighting.md): Documentation about how to create a custom weighting class to influence the track calculation.
54
54
*[Import GTFS](../reader-gtfs): Simple steps to get GTFS import and routing done.
55
55
*[LocationIndex](../example/src/main/java/com/graphhopper/example/LocationIndexExample.java): Code about how to get the location index for getting i.e. the nearest edge.
56
56
*[Hybrid Mode](./core/landmarks.md): Details about speeding up the route calculation via A* and landmarks.
57
57
*[Speed Mode](./core/ch.md): Details about speeding up the route calculations via [Contraction Hierarchies](http://en.wikipedia.org/wiki/Contraction_hierarchies).
58
58
*[Low level API](./core/low-level-api.md): Instructions how to use GraphHopper as a Java library.
59
-
*[Create new FlagEncoder](./core/create-new-flagencoder.md): Documentation to create new routing profiles to influence which ways to favor and how the track-time is calculated.
60
59
*[Custom Areas and Country Rules](./core/custom-areas-and-country-rules.md): Instructions on how to on how to use and create new SpatialRules. SpatialRules are used to enforce country-specific routing rules.
61
60
*[Turn Restrictions](./core/turn-restrictions.md): Details on how to enable and use turn restrictions.
62
61
*[Isochrone generation in Java](./isochrone/java.md): Instruction on how to create isochrones using the low-level Java API.
0 commit comments