Disabling CH not allowed on the server-side?


I have created a GraphHopper server on Windows. Directions API seems to be working, but I want to avoid motorways. In order to do so I have added “ch.disable=true” and “avoid=motorway” to the request, but the server returns:
“{“message”:“Disabling CH not allowed on the server-side”,“hints”:[{“message”:“Disabling CH not allowed on the server-side”,“details”:“java.lang.IllegalArgumentException”}]}”.

Does that mean we can’t have directions with avoid parameter?

As this has performance implications for every request you have to explicitly allow this on the server side (and restart):

    routing.ch.disabling_allowed: true

Thanks, will try that.

@karussell sure this will work on the open source routing engine as well?

avoid=motorway or avoid=toll seems not to have any effect in my local environment (0.11):



Ah, you are right about this. We are currently implementing a better “flexible” system for those cases. Please see this branch instead: https://github.com/graphhopper/graphhopper/tree/flex_vehicleprofile

Where you can specify the avoid factor either per request in the json/yml or on import: https://github.com/graphhopper/graphhopper/blob/flex_vehicleprofile/web/src/test/resources/com/graphhopper/http/resources/fire_truck.yml#L20

We’ll probably merge this or a similar version of it in the near future.

Update: there is a more recent flex_vehicleprofile2 branch

Many thanks - I’ll give a try during next days, as I’m getting an error while trying running flex_veichleprofile branch

## using java 1.8.0_102 (64bit) from 
## using existing osm file taa.pbf
## existing jar found web/target/graphhopper-web-0.12-SNAPSHOT.jar
## now web. JAVA_OPTS=-Xmx1000m -Xms1000m
io.dropwizard.configuration.ConfigurationParsingException: config.yml has an error:
  * Unrecognized field at: server.applicationConnectors
    Did you mean?:
      - application_connectors
      - application_context_path
      - admin_connectors
      - admin_min_threads
      - allowed_methods
        [22 more]

	at io.dropwizard.configuration.ConfigurationParsingException$Builder.build(ConfigurationParsingException.java:279)
	at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:140)

Ah, yes. Thanks for the feedback on this fresh work. The problem is that I wanted to avoid to annotate every Java property which is in “camelCase” with its “under_score” JSON notation and so I used this configuration for jackson:


As this is a global change the config.yml has to be changed too:

# Dropwizard server configuration
  - type: http
    port: 8989
    # for security reasons bind to localhost
    bind_host: localhost
      appenders: []
  - type: http
    port: 8990
    bind_host: localhost

Don’t ask me why requestLog has to stay in camelCase :slight_smile:

To see the branch in action you can look into the tests: https://github.com/graphhopper/graphhopper/blob/flex_vehicleprofile/web/src/test/java/com/graphhopper/http/resources/FlexResourceTest.java

If this branch is too experimental for your case, then this pull request could be interesting, but this requires probably a bit more Java and GH knowledge.

Perfect, I can compile and lunch now. Thanks!

Options &ch.disable=true&avoid=toll do not seem to work our of the box, you wrote:

If I got it correctly, in order to implement toll avoidance, I need to define a new vehicle (fire_truck is an example) with proper wording in the “no_access” section - correct?

Thanks for your help

The request format is different as we plan to make things more customizable URL parameters are not the best choice. You’ll need to POST a JSON. See the tests.

If I got it correctly, in order to implement toll avoidance, I need to define a new vehicle (fire_truck is an example) with proper wording in the “no_access” section - correct?

You can define a new vehicle in the config:

graph.encoding_manager: some_vehicle.yml

but it should also work to do a POST request against the new “/flex” endpoint, even if you only have car defined. To make it working use the JSON similar to the one in the test. (Currently this is inconsistent: import requires yml file, request requires JSON, in the future both will be supported for both scenarios)

Ah, I believe I got it, I focused on the fire_truck example which makes a get request http://localhost:8080/route?...vehicle=fire_truck&weighting=flex while I see now I need to target /flex endpoint with a POST request as per the wheelchair examples.

Thanks again

1 Like

Maybe I should open another post, I’m having some troubles with the POST request, is there any document explaining the format?

curl -i -X POST -H 'Content-Type: application/json' -d '{"request": { "points" : [[11.248630, 46.030340], [11.265450, 46.325830] ] }, "model": { "base":"car"} }' http://localhost:8989/flex

HTTP/1.1 400 Bad Request
Date: Wed, 10 Oct 2018 20:00:01 GMT
Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS
Access-Control-Allow-Headers: Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers
Access-Control-Allow-Origin: *
Content-Type: application/json
Content-Length: 188

{"message":"No path found due to maximum nodes exceeded 1000000","hints":[{"message":"No path found due to maximum nodes exceeded 1000000","details":"java.lang.IllegalArgumentException"}]}

Same thing if I try something more elaborated as in the java example linked above:

	"request": {
		"points": [
			[11.248630, 46.030340],
			[11.265450, 46.325830]
	"model": {
		"base": "car",
		"no_access": {
			"road_class": ["steps"]

note the GET query for same areas works:

See follow up here: Flexible Vehicle Profiles

Hi there !
I’m using the open source routing engine and its web API, if i understand well this discussion (and its follow up :wink: ) the “avoid” parameter is not available in the API, right ? Will it be available in the future ?
I’m VERY interested in avoiding motorway and toll !

BTW, well done for this fantastic work !

The avoid parameter is not yet in the master branch. We tried to introduce it here but we decided that this needs a separate issue. Maybe we’ll wait until the flexible branch is integrated, maybe it comes earlier we do not know yet. But it will be there :slight_smile:

1 Like

how can I change this in the graphhopper?

I mean what is that file I can edit this comment?

I uncomment that command in the yml file and restart it, but it still not work.