graphhopper / graphhopper

Open source routing engine for OpenStreetMap. Use it as Java library or standalone web server.

Home Page:https://www.graphhopper.com/open-source/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not create weighting for profile: 'truck'

felipemendes1994 opened this issue · comments

Hello,

I'm trying to run Graph Hopper in my k8s cluster, and I just changed to 8 version, and I've been facing a problem when trying to compile my PBF for the new version.

I'm receiving the following error:

java.lang.IllegalArgumentException: Could not create weighting for profile: 'truck'.
Profile: name=truck|vehicle=roads|weighting=custom|turnCosts=false|hints={custom_model_files=[truck.json], custom_model=distanceInfluence=1.0|headingPenalty=null|speedStatements=[{"if": "true", "limit_to": car_average_speed * 0.9}, {"if": "true", "limit_to": 95}]|priorityStatements=[{"if": "road_access == PRIVATE", "multiply_by": 0}, {"if": "car_access == false || hgv == NO || max_width < 3 || max_height < 4", "multiply_by": 0}]|areas=[]}
Error: Cannot compile expression: priority entry invalid condition "car_access == false || hgv == NO || max_width < 3 || max_height < 4": 'hgv' not available
	at com.graphhopper.GraphHopper.checkProfilesConsistency(GraphHopper.java:1122)
	at com.graphhopper.GraphHopper.process(GraphHopper.java:881)
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:840)
	at com.graphhopper.http.GraphHopperManaged.start(GraphHopperManaged.java:44)
	at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
	at org.eclipse.jetty.server.Server.start(Server.java:423)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
	at org.eclipse.jetty.server.Server.doStart(Server.java:387)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
	at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:52)
	at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:68)
	at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)
	at io.dropwizard.cli.Cli.run(Cli.java:78)
	at io.dropwizard.Application.run(Application.java:94)
	at com.graphhopper.application.GraphHopperApplication.main(GraphHopperApplication.java:38)

I browsed into other issues here on GitHub, but non helped me.

Here it is my config.yml file:

graphhopper:
    datareader.file: ""
    graph.location: graph-cache
    custom_models.directory: /graphhopper/profiles
    profiles:
    - name: car
        vehicle: car
        custom_model:
        distance_influence: 70
    - name: truck
        vehicle: roads
        weighting: custom
        custom_model_files: [ truck.json ]
    profiles_ch:
    - profile: car
    - profile: truck
    profiles_lm: []
    prepare.subnetworks.threads: 1
    routing.non_ch.max_waypoint_distance: 1000000
    import.osm.ignored_highways: footway,cycleway,path,pedestrian,steps
    graph.dataaccess.default_type: RAM_STORE
    graph.flag_encoders: roads|hgv=true
server:
    application_connectors:
    - type: http
    port: 8989
    bind_host: localhost
    max_request_header_size: 50k
    request_log:
        appenders: []
    admin_connectors:
    - type: http
    port: 8990
    bind_host: localhost
logging:
    appenders:
    - type: file
        time_zone: UTC
        current_log_filename: logs/graphhopper.log
        log_format: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
        archive: true
        archived_log_filename_pattern: ./logs/graphhopper-%d.log.gz
        archived_file_count: 30
        never_block: true
    - type: console
        time_zone: UTC
        log_format: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
    loggers:
    "com.graphhopper.osm_warnings":
        level: DEBUG
        additive: false
        appenders:
        - type: file
            currentLogFilename: logs/osm_warnings.log
            archive: false
            logFormat: '[%level] %msg%n'

the truck.json file that I placed in my graphopper, is exactly the same in this repo. When I was using version 7, this problem did not occur.

Can sameone help me, please?

You can follow the CHANGELOG when you upgrade a GraphHopper version.

I'm not sure why this config worked in version 7 but you have to specify hgv in graph.encoded_values. Furthermore instead of graph.flag_encoders you now use graph.vehicles.

For questions please use our forum (instead of the issue list here).