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
Copy file name to clipboardexpand all lines: docs/valhalla_service.md
+67-81
Original file line number
Diff line number
Diff line change
@@ -14,16 +14,16 @@ TODO - more get started section/links.
14
14
15
15
### Service limits
16
16
17
-
Valhalla is a free, shared routing service. As such, there are limitations on requests, maximum distances, and numbers of locations to prevent individual users from degrading the overall system performance. Limits may be increased in the future, but the following are currently in place:
17
+
Valhalla is a free, shared routing service. As such, there are limitations on requests, maximum distances, and numbers of locations to prevent individual users from degrading the overall system performance.
18
+
19
+
The following distance limitations are currently in place:
18
20
19
-
* XXX requests per second.
20
-
* YYY requests per day.
21
21
* Pedestrian routes have a limit of 100 kilometers.
22
22
* Bicycle routes have a limit of 500 kilometers.
23
23
* Automobile routes have a limit of 5,000 kilometers.
24
24
* No more than two locations can be provided.
25
25
26
-
Contact routing@mapzen.com if you need higher limits in the meantime.
26
+
Limits may be increased in the future, but you can contact routing@mapzen.com if you encounter rate limit status messages and need higher limits in the meantime.
27
27
28
28
### Build a Valhalla route request
29
29
@@ -58,7 +58,7 @@ Optionally, you can include the following location information without impacting
58
58
* phone = Phone.
59
59
* url = URL for the place or location.
60
60
61
-
Future Valhalla development work includes adding location options and information related to time at each location. This will allow routes to specify a start time or an arrive by time at each location.
61
+
Future Valhalla development work includes adding location options and information related to time at each location. This will allow routes to specify a start time or an arrive by time at each location. There is also ongoing work to improve support for `through` locations.
62
62
63
63
#### Costing models
64
64
@@ -77,7 +77,7 @@ Valhalla uses dynamic, run-time costing to generate the route path. The route re
77
77
Costing methods can have several options that can be adjusted to develop the the route path, as well as for estimating time along the path. Specify costing model options in your request using the format of `costing_options.type`, such as ` costing_options.auto`.
78
78
79
79
* Cost options are fixed costs in seconds that are added to both the path cost and the estimated time. Examples of costs are `gate_costs` and `toll_booth_costs`, where a fixed amount of time is added. Costs are not generally used to influence the route path; instead, use penalties to do this.
80
-
* Penalty options are fixed costs in seconds that are only added to the path cost. Penalties can influence the route path determination but do not add to the estimated time along the path. For exmaple, add a `toll_booth_penalty` to create route paths that tend to avoid toll booths.
80
+
* Penalty options are fixed costs in seconds that are only added to the path cost. Penalties can influence the route path determination but do not add to the estimated time along the path. For example, add a `toll_booth_penalty` to create route paths that tend to avoid toll booths.
81
81
* Factor options are used to multiply the cost along an edge or road section in a way that influences the path to favor or avoid a particular attribute. Factor options do not impact estimated time along the path, though. Factors must be in the range 0.25 to 100000.0, where factors of 1.0 have no influence on cost. Use a factor less than 1.0 to attempt to favor paths containing preferred attributes, and a value greater than 1.0 to avoid paths with undesirable attributes. Avoidance factors are more effective than favor factors at influencing a path. A factor's impact also depends on the length of road containing the specified attribute, as longer roads have more impact on the costing than very short roads. For this reason, penalty options tend to be better at influencing paths.
82
82
83
83
##### Automobile and bus costing options
@@ -94,11 +94,11 @@ These options are available for `auto`, `auto_shorter`, and `bus` costing method
94
94
| country_crossing_penalty | A penalty applied for a country crossing. This penalty can be used to create paths that avoid spanning country boundaries. The default penalty is 0. |
95
95
96
96
##### Bicycle costing options
97
-
A default bicycle costing method has been implemented, but its options are currently being evaluated. The default bicycle costing is tuned towards road bicycles with a preference for using [cycleways](http://wiki.openstreetmap.org/wiki/Key:cycleway) or roads with bicycle lanes. Bicycle routes use regular roads where needed or where no direct bicycle lane options exist, but avoid roads without bicycle access. Rough road surfaces and mountain bike trails are currently disallowed for bicycle paths, but future methods may consider the bicycle type and enable their use use by cyclo-cross or mountain bicycles.
97
+
A default bicycle costing method has been implemented, but its options are currently being evaluated. The default bicycle costing is tuned toward road bicycles with a preference for using [cycleways](http://wiki.openstreetmap.org/wiki/Key:cycleway) or roads with bicycle lanes. Bicycle routes use regular roads where needed or where no direct bicycle lane options exist, but avoid roads without bicycle access. Rough road surfaces and mountain bike trails are currently disallowed for bicycle paths, but future methods may consider the bicycle type and enable their use use by cyclo-cross or mountain bicycles.
98
98
99
99
##### Pedestrian costing options
100
100
101
-
These options are available for pedestrian routes (using the standard pedestrian costing model):
101
+
These options are available for pedestrian costing methods.
102
102
103
103
| Pedestrian options | Description |
104
104
| -------------------------- | ----------- |
@@ -113,94 +113,80 @@ These options are available for pedestrian routes (using the standard pedestrian
113
113
| Options | Description |
114
114
| ------------------ | ----------- |
115
115
| units | Distance units. Allowable unit types are miles (or mi) and kilometers (or km). If no unit type is specified, the units default to kilometers. |
116
-
| language | The language of the narration instructions. If no language is specified, United States-based English (en_US) is used. The current list of supported languages: en_US. |
116
+
| language | The language of the narration instructions. If no language is specified, United States-based English (en_US) is used. Currently supported languages: en_US. |
117
117
|outformat | Output format. Allowable output formats are .json and .pbf (protocol buffer). If no `outformat` is specified, .json is returned. |
118
118
119
+
### JSON output
119
120
120
-
### JSON Output
121
-
122
-
The selected units of length are returned:
123
-
124
-
units = "kilometers" (or "miles").
125
-
126
-
#### Trip
127
-
128
-
The route results are returned as a **trip**. This is a JSON object that contains details about the trip, including locations, a summary, and a list of **legs**.
129
-
130
-
##### Locations
131
-
Location information is returned in the same form as it is entered with additional fields:
121
+
The route results are returned as a trip. This is a JSON object that contains details about the trip, including locations, a summary with basic information about the entire trip, and a list of legs. Location information is returned in the same form as it is entered with additional fields to indicate the side of the street.
132
122
133
-
* sos = Side of street. Possible values are: **right**, **left**, or **ind** (indeterminant).
123
+
| Item | Description |
124
+
| ---- | ----------- |
125
+
| units | The specified units of length are returned, either kilometers or miles. |
126
+
| sos | Side of street. Possible values are: `right`, `left`, or `ind` (indeterminant). |
127
+
| time | Estimated elapsed time to complete the trip. |
128
+
| length | Length (distance) traveled for the entire trip. Units are either miles or kilometers based on the input units specified. |
134
129
135
-
##### Summary
130
+
####Legs and maneuvers of a trip
136
131
137
-
The trip summary includes basic details about the entire trip including:
132
+
A trip may include multiple legs. For `n` number of `break` locations, there are `n-1` legs. `Through` locations do not create separate legs.
138
133
139
-
* time = Estimated elapsed time to complete the trip.
140
-
* length = Length (distance) traveled for the entire trip. Units are either miles or kilometers based on the input units specified.
134
+
Each leg of the trip includes a summary, which is comprised of the same information as a trip summary but applied to the single leg of the trip. It also includes a `shape`, which is an [encoded polyline](https://developers.google.com/maps/documentation/utilities/polylinealgorithm) of the route path, and a list of `maneuvers` as a JSON array.
141
135
142
-
##### Legs
136
+
These maneuvers contain the following items.
143
137
144
-
A trip may include multiple legs. For n break locations there are n-1 legs. Through locations do not create a separate legs.
138
+
| Maneuver items | Description |
139
+
| --------- | ---------- |
140
+
| type | Type of maneuver. See below for a list. |
141
+
| instruction | Written maneuver instruction. Describes the maneuver, such as "Turn right onto Main Street". |
142
+
| street_names | List of street names. |
143
+
| time | Estimated time along the maneuver in seconds. |
144
+
| length | Maneuver length in the units specified. |
145
+
| begin_shape_index | Index into the list of shape points for the start of the maneuver. |
146
+
| end_shape_index | Index into the list of shape points for the end of the maneuver. |
147
+
| toll | True if the maneuver has any toll, or portions of the maneuver are subject to a toll. |
148
+
| rough | True if the maneuver is unpaved or rough pavement or has any portions that have rough pavement. |
149
+
| gate | True if a gate is encountered on this maneuver. |
150
+
| ferry | True if a ferry is encountered on this maneuver. |
145
151
146
-
Each leg of the trip includes a summary (comprised of the same information as a trip summary but applied to the single leg of the trip). It also includes the following:
152
+
The following are the available types of maneuvers:
147
153
148
-
* shape = Encoded shape (using Google polyline encoding - ADD LINK) of the route path.
149
-
* maneuvers = A list (JSON array) of maneuvers
150
-
151
-
###### Maneuver
152
-
153
-
Each maneuver includes the following:
154
-
155
-
* type = Type
156
154
```
157
-
kNone = 0;
158
-
kStart = 1;
159
-
kStartRight = 2;
160
-
kStartLeft = 3;
161
-
kDestination = 4;
162
-
kDestinationRight = 5;
163
-
kDestinationLeft = 6;
164
-
kBecomes = 7;
165
-
kContinue = 8;
166
-
kSlightRight = 9;
167
-
kRight = 10;
168
-
kSharpRight = 11;
169
-
kUturnRight = 12;
170
-
kUturnLeft = 13;
171
-
kSharpLeft = 14;
172
-
kLeft = 15;
173
-
kSlightLeft = 16;
174
-
kRampStraight = 17;
175
-
kRampRight = 18;
176
-
kRampLeft = 19;
177
-
kExitRight = 20;
178
-
kExitLeft = 21;
179
-
kStayStraight = 22;
180
-
kStayRight = 23;
181
-
kStayLeft = 24;
182
-
kMerge = 25;
183
-
kRoundaboutEnter = 26;
184
-
kRoundaboutExit = 27;
185
-
kFerryEnter = 28;
186
-
kFerryExit = 29;
155
+
kNone = 0;
156
+
kStart = 1;
157
+
kStartRight = 2;
158
+
kStartLeft = 3;
159
+
kDestination = 4;
160
+
kDestinationRight = 5;
161
+
kDestinationLeft = 6;
162
+
kBecomes = 7;
163
+
kContinue = 8;
164
+
kSlightRight = 9;
165
+
kRight = 10;
166
+
kSharpRight = 11;
167
+
kUturnRight = 12;
168
+
kUturnLeft = 13;
169
+
kSharpLeft = 14;
170
+
kLeft = 15;
171
+
kSlightLeft = 16;
172
+
kRampStraight = 17;
173
+
kRampRight = 18;
174
+
kRampLeft = 19;
175
+
kExitRight = 20;
176
+
kExitLeft = 21;
177
+
kStayStraight = 22;
178
+
kStayRight = 23;
179
+
kStayLeft = 24;
180
+
kMerge = 25;
181
+
kRoundaboutEnter = 26;
182
+
kRoundaboutExit = 27;
183
+
kFerryEnter = 28;
184
+
kFerryExit = 29;
187
185
```
188
-
* instruction = Written maneuver instruction. Describes the maneuver (e.g., "Turn right onto Main Street").
189
-
* street_names = List of street names.
190
-
* time = Estimated time along the maneuver in seconds.
191
-
* length = Maneuver length in the units specified.
192
-
* begin_shape_index = Index into the list of shape points for the start of the maneuver.
193
-
* end_shape_index = Index into the list of shape points for the end of the maneuver.
194
-
* toll = True if the maneuver has any toll or portions of the maneuver are subject to a toll.
195
-
* rough = True if the maneuver is unpaved/rough pavement or has any portions that have rough pavement.
196
-
* gate = True if a gate is encountered on this maneuver.
197
-
* ferry = True if a ferry is encountered on this maneuver.
198
-
199
-
FUTURE: Look for additional maneuver information to enhance navigation applications - features like verbal instructions and landmark usage.
186
+
187
+
In the future, look for additional maneuver information to enhance navigation applications, including verbal instructions and landmark usage.
0 commit comments