How to use road speed per request in graphhopper routing

As per the graphhopper 0.9 release, it says

A new graph change API to change road speed and access properties, #845. Can be applied before preprocessing or per-request.

how do i use it, can someone point me to the documentation with example ?

i got the answer as per the stackoverflow.

i send the data using
curl -H “Content-Type: application/json” --data @geo.json http://localhost:8989/change

geo.json is as below

“type”: “FeatureCollection”,
“features”: [{
“type”: “Feature”,
“geometry”: {
“type”: “Point”,
“coordinates”: [76.29511892795564,10.014432817025117]
“properties”: {
“vehicles”: [“car”],
“speed”: 5

i am getting response
{ “message” : “Not found” }

i am using the configuration as,

The change endpoint is disabled by default, you have to enable it first:

        if (args.getBool("web.change_graph.enabled", false)) {

It should be enough to specify web.change_graph.enabled=true in your environment variables.


@dinomycle, sorry, I am currently writing the documentation for this feature and while testing this I saw that you currently cannot enable the change servlet in the config, but you have to set it as environment variable. We will see if we can fix this issue though.

I just added the relevant part of the documentation I am currently writing. Hope this helps.

First, enable the /change endpoint. On a Unix system, open the terminal and go to the GraphHopper directory.
Type export GH_WEB_OPTS=web.change_graph.enabled=true. Start graphhopper by typing web <your-pbf>.
In this example we use the baden-wuerttemberg-latest.osm.pbf.

You can view the test route here.

For this example we will assume that you use the car profile. You can now send the following Geojson as POST to the
/change endpoint. This Geojson will change the access value of the road at 48.685266, 9.260648 to false.

     "type": "FeatureCollection",
     "features": [{
       "type": "Feature",
       "geometry": {
         "type": "Point",
         "coordinates": [9.260648, 48.685266]
       "properties": {
         "vehicles": ["car"],
         "access": false

You can send the POST with curl like this: curl -H "Content-Type: application/json" -X POST -d '{"type": "FeatureCollection","features": [{"type": "Feature","geometry": {"type": "Point","coordinates": [9.260648, 48.685266]},"properties": {"vehicles": ["car"],"access": false}}]}' http://localhost:8989/change

If you visit the test url from above again, you will see that the route changed and parts of the L 1202 have become
inaccessible for GraphHopper’s car profile. Bike or Foot will still use this road (if you enabled them as well).

1 Like

yes this works now, thanks for the support

i have another question now, how do i do this based on per request for routing API call ?
For the below query when i do, i want this road to have access as false


and if another user queries it, it should be with this road access as true

This works different. You don’t need the change endpoint then. Currently we only allow blocking roads, or areas, but not changing the speed. See the block_area parameter.


so what does it mean by
new graph change API to change road speed and access properties, #845. Can be applied before preprocessing or per-request.

i assume that we can have a routing API request, and for this particular request i can have these road setting as a explained previously
or tell me how can we achieve it, As for our current system, we are going to create a database where i have information for each road, what will be the speed to be used for that particular time range.