@@ -86,14 +86,43 @@ This can be changed via the `--output_image` & `--output_map` parameters.
8686The map plot should look like [ this] ( https://nextmv-io.github.io/nextplot/plots/dortmund-route ) :
8787![ dortmund-route.json.html.png] ( https://nextmv-io.github.io/nextplot/plots/dortmund-route/dortmund-route.json.html.png )
8888
89- ## Route plotting with routingkit support
89+ ## Route plotting with OSRM support
9090
91- Next, we're gonna plot routes using the road network. We do this with the
92- support of [ go-routingkit ] ( go-routingkit ) .
91+ Next, we will plot routes using the road network. We do this with the support of
92+ [ OSRM ] [ osrm ] . Make sure a server with a suitable region and profile is running .
9393
94- ### Pre-requisites
94+ ### Pre-requisites for OSRM
9595
96- 1 . Install [ go-routingkit] ( go-routingkit ) standalone:
96+ 1 . Spin up an OSRM server with a suitable region and profile. Follow the
97+ [ steps] [ osrm-install ] provided by OSRM to get started.
98+
99+ ### Plot route paths via OSRM
100+
101+ The command is similar to the one above, but specifies some extra options (refer
102+ to the full list [ below] ( #additional-information ) ). The ` osrm_host ` option
103+ activates OSRM driven plotting.
104+
105+ ``` bash
106+ nextplot route \
107+ --input_route data/kyoto-route.json \
108+ --jpath_route " vehicles[*].route" \
109+ --jpath_x " position.lon" \
110+ --jpath_y " position.lat" \
111+ --output_map kyoto-route.html \
112+ --output_image kyoto-route.png \
113+ --osrm_host http://localhost:5000
114+ ```
115+
116+ ## Route plotting with RoutingKit support
117+
118+ Another option to plot routes is to use the [ go-routingkit] [ go-rk ] library which
119+ comes with a standalone binary. This approach does not need a running server,
120+ but takes longer to compute the routes (as it needs to preprocess the osm file
121+ on each run).
122+
123+ ### Pre-requisites for RoutingKit
124+
125+ 1 . Install [ go-routingkit] [ go-rk ] standalone:
97126
98127 ``` bash
99128 go install github.com/nextmv-io/go-routingkit/cmd/routingkit@latest
@@ -106,7 +135,7 @@ support of [go-routingkit](go-routingkit).
106135 wget -N http://download.geofabrik.de/asia/japan/kansai-latest.osm.pbf
107136 ` ` `
108137
109- # ## Plot route paths
138+ # ## Plot route paths via RoutingKit
110139
111140The command is similar to the one above, but specifies some extra options (refer
112141to the full list [below](# additional-information)). The `rk_osm` option
@@ -299,6 +328,9 @@ handle certain data formats. Find an outline of these options here:
299328- `--stats_file <path-to-file>`:
300329 If provided, statistics will be written to the given file in addition to
301330 stdout.
331+ - `osrm_host` (route only):
332+ Host of the OSRM server to be used for routing. If provided, routes will be
333+ generated via OSRM. Example: `http://localhost:5000`.
302334- `rk_bin` (route only):
303335 Path to the [go-routingkit][go-rk] standalone binary. Alternatively,
304336 `routingkit` command will be used at default (requires go-routingkit
@@ -315,5 +347,7 @@ handle certain data formats. Find an outline of these options here:
315347
316348[go-rk]: https://github.com/nextmv-io/go-routingkit/tree/stable/cmd/routingkit
317349[go-rk-install]: https://github.com/nextmv-io/go-routingkit/tree/stable/cmd/routingkit#install
350+ [osrm]: https://project-osrm.org/
351+ [osrm-install]: https://github.com/Project-OSRM/osrm-backend?tab=readme-ov-file#quick-start
318352[custom-layers]: http://leaflet-extras.github.io/leaflet-providers/preview/
319353[folium-tiles]: https://deparkes.co.uk/2016/06/10/folium-map-tiles/
0 commit comments