@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 graphhopper.sh 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).