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/nodejs/api.md
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,7 @@ Returns the fastest route between two or more coordinates while visiting the way
64
64
-`options.approaches`**[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
65
65
`null`/`true`/`false`
66
66
-`options.waypoints`**[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
67
+
-`options.format`**[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
67
68
-`options.snapping`**[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
68
69
-`options.skip_waypoints`**[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of response and do not want to transfer waste data. (optional, default `false`)
@@ -99,6 +100,7 @@ Note: `coordinates` in the general options only supports a single `{longitude},{
99
100
-`options.number`**[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of nearest segments that should be returned.
100
101
Must be an integer greater than or equal to `1`. (optional, default `1`)
101
102
-`options.approaches`**[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)?** Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
103
+
-`options.format`**[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
102
104
-`options.snapping`**[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
-`plugin_config`**[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Object literal containing parameters for the trip query.
336
338
-`plugin_config.format`**[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The format of the result object to various API calls.
337
-
Valid options are `object` (default), which returns a
338
-
standard Javascript object, as described above, and `json_buffer`, which will return a NodeJS
339
-
**[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string. The latter has
340
-
the advantage that it can be immediately serialized to disk/sent over the network, and the
341
-
generation of the string is performed outside the main NodeJS event loop. This option is ignored
342
-
by the `tile` plugin.
339
+
Valid options are `object` (default if `options.format` is
340
+
`json`), which returns a standard Javascript object, as described above, and `buffer`(default if
341
+
`options.format` is `flatbuffers`), which will return a NodeJS
342
+
**[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string or Flatbuffers
343
+
object. The latter has the advantage that it can be immediately serialized to disk/sent over the
344
+
network, and the generation of the string is performed outside the main NodeJS event loop. This
345
+
option is ignored by the `tile` plugin. Also note that `options.format` set to `flatbuffers`
346
+
cannot be used with `plugin_config.format` set to `object`. `json_buffer` is deprecated alias for
* @param {Array} [options.approaches] Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
300
321
* `null`/`true`/`false`
301
322
* @param {Array} [options.waypoints] Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index.
323
+
* @param {String} [options.format] Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
302
324
* @param {String} [options.snapping] Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
303
325
* @param {Boolean} [options.skip_waypoints=false] Removes waypoints from the response. Waypoints are still calculated, but not serialized. Could be useful in case you are interested in some other part of response and do not want to transfer waste data.
304
326
* @param {Function} callback
@@ -340,6 +362,7 @@ NAN_METHOD(Engine::route) //
340
362
* @param {Number} [options.number=1] Number of nearest segments that should be returned.
341
363
* Must be an integer greater than or equal to `1`.
342
364
* @param {Array} [options.approaches] Keep waypoints on curb side. Can be `null` (unrestricted, default) or `curb`.
365
+
* @param {String} [options.format] Which output format to use, either `json`, or [`flatbuffers`](https://github.com/Project-OSRM/osrm-backend/tree/master/include/engine/api/flatbuffers).
343
366
* @param {String} [options.snapping] Which edges can be snapped to, either `default`, or `any`. `default` only snaps to edges marked by the profile as `is_startpoint`, `any` will allow snapping to any edge in the routing graph.
344
367
* @param {Function} callback
345
368
*
@@ -606,12 +629,15 @@ NAN_METHOD(Engine::trip) //
606
629
* @name Configuration
607
630
* @param {Object} [plugin_config] - Object literal containing parameters for the trip query.
608
631
* @param {String} [plugin_config.format] The format of the result object to various API calls.
609
-
* Valid options are `object` (default), which returns a
610
-
* standard Javascript object, as described above, and `json_buffer`, which will return a NodeJS
611
-
* **[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string. The latter has
612
-
* the advantage that it can be immediately serialized to disk/sent over the network, and the
613
-
* generation of the string is performed outside the main NodeJS event loop. This option is ignored
614
-
* by the `tile` plugin.
632
+
* Valid options are `object` (default if `options.format` is
633
+
* `json`), which returns a standard Javascript object, as described above, and `buffer`(default if
634
+
* `options.format` is `flatbuffers`), which will return a NodeJS
635
+
* **[Buffer](https://nodejs.org/api/buffer.html)** object, containing a JSON string or Flatbuffers
636
+
* object. The latter has the advantage that it can be immediately serialized to disk/sent over the
637
+
* network, and the generation of the string is performed outside the main NodeJS event loop. This
638
+
* option is ignored by the `tile` plugin. Also note that `options.format` set to `flatbuffers`
639
+
* cannot be used with `plugin_config.format` set to `object`. `json_buffer` is deprecated alias for
0 commit comments