Custom model not being considered in LM profile

Hello guys

I’m having a problem trying to use a custom profile (big_truck) in LM.

I made a test in my local graphhopper (I didn’t have lm activated for any profile at that time), with the following custom_model:

    {
        "priority": [
            {
                "if": "road_class == MOTORWAY",
                "multiply_by": "1"
            },
            {
                "if": "road_class == TRUNK",
                "multiply_by": "0.8"
            },
            {
                "if": "road_class == PRIMARY",
                "multiply_by": "0.7"
            },
            {
                "if": "max_width < 3 || max_height < 4",
                "multiply_by": "0.01"
            },
            {
                "if": "max_weight < 18",
                "multiply_by": "0.01"
            },
            {
                "else": "",
                "multiply_by": "1.0"
            }
        ],
        "speed": [
            {
                "if": "true",
                "limit_to": "car_average_speed * 0.9"
            },
            {
                "if": "max_height < 4.5",
                "multiply_by": "0.5"
            },
            {
                "if": "max_weight < 40",
                "multiply_by": "0.5"
            },
            {
                "else": "",
                "multiply_by": "1.0"
            }
        ]
    }

And a request with the following points

        [
            -46.849295862, -23.660373695
        ],
        [
            -46.52801412, -23.652824031
        ]

made the following route

And that’s was what I expected.

But during the import time, I received an error, related to this topic here [Error indexing graphhopper maps - #4 by karussell], and I need to modify my embedded custom as it was instructed.

Custom profile activated as expected, but now It seems the custom model is not being considered in LM. Neither the custom model I provided in import time, neither custom model inside the request.

I mean:

If I request this:

{
    "points": [
        [
            -46.849295862, -23.660373695
        ],
        [
            -46.52801412, -23.652824031
        ]
    ],
    "profile": "big_truck",
    "locale": "pt_BR",
    "pointsEncoded": true,
    "custom_model": {}, 
    "ch.disable": true,
    "lm.disable": false
}

or this:

{
    "points": [
        [
            -46.849295862,
            -23.660373695
        ],
        [
            -46.52801412,
            -23.652824031
        ]
    ],
    "profile": "big_truck",
    "locale": "pt_BR",
    "pointsEncoded": true,
    "custom_model": {
        "priority": [
            {
                "if": "road_class == MOTORWAY", "multiply_by": "1"
            },
            {
                "if": "road_class == TRUNK", "multiply_by": "0.8"
            },
            {
                "if": "road_class == PRIMARY","multiply_by": "0.7"
            },
            {
                "if": "max_width < 3 || max_height < 4","multiply_by": "0.01"
            },
            {
                "if": "max_weight < 18","multiply_by": "0.01"
            },
            {
                "else": "","multiply_by": "1.0"
            }
        ],
        "speed": [
            {
                "if": "true","limit_to": "car_average_speed * 0.9"
            },
            {
                "if": "max_height < 4.5","multiply_by": "0.5"
            },
            {
                "if": "max_weight < 40","multiply_by": "0.5"
            },
            {
                "else": "","multiply_by": "1.0"
            }
        ]
    },
    "ch.disable": true,
    "lm.disable": false
}

or this:

{
    "points": [
        [
            -46.849295862,
            -23.660373695
        ],
        [
            -46.52801412,
            -23.652824031
        ]
    ],
    "profile": "big_truck",
    "locale": "pt_BR",
    "pointsEncoded": true,
    "custom_model": {
        "priority": [
            {
                "if": "road_class == MOTORWAY", "multiply_by": "1"
            },
            {
                "if": "road_class == TRUNK", "multiply_by": "0.8"
            },
            {
                "if": "road_class == PRIMARY","multiply_by": "0.7"
            },
            {
                "if": "max_width < 3 || max_height < 4","multiply_by": "0"
            },
            {
                "if": "max_weight < 18","multiply_by": "0"
            },
            {
                "else": "","multiply_by": "1.0"
            }
        ],
        "speed": [
            {
                "if": "true","limit_to": "car_average_speed * 0.9"
            },
            {
                "if": "max_height < 4.5","multiply_by": "0.5"
            },
            {
                "if": "max_weight < 40","multiply_by": "0.5"
            },
            {
                "else": "","multiply_by": "1.0"
            }
        ]
    },
    "ch.disable": true,
    "lm.disable": false
}

I receive the exactly same route:

I also tried disabling LM and CH:

{
    "points": [
        [
            -46.849295862,
            -23.660373695
        ],
        [
            -46.52801412,
            -23.652824031
        ]
    ],
    "profile": "big_truck",
    "locale": "pt_BR",
    "pointsEncoded": true,
    "custom_model": {
        "priority": [
            {
                "if": "road_class == MOTORWAY", "multiply_by": "1"
            },
            {
                "if": "road_class == TRUNK", "multiply_by": "0.8"
            },
            {
                "if": "road_class == PRIMARY","multiply_by": "0.7"
            },
            {
                "if": "max_width < 3 || max_height < 4","multiply_by": "0.01"
            },
            {
                "if": "max_weight < 18","multiply_by": "0.01"
            },
            {
                "else": "","multiply_by": "1.0"
            }
        ],
        "speed": [
            {
                "if": "true","limit_to": "car_average_speed * 0.9"
            },
            {
                "if": "max_height < 4.5","multiply_by": "0.5"
            },
            {
                "if": "max_weight < 40","multiply_by": "0.5"
            },
            {
                "else": "","multiply_by": "1.0"
            }
        ]
    },
    "ch.disable": true,
    "lm.disable": true
}

but nothing seems to affect the route. It seems custom model is been completely ignored.

Any idea about that?

Maybe try making a purposeful spelling mistake, like multiplyby (without the underscore), do you get an error then? Also note that you are mixing camel-case (pointsEncoded) with underscore (custom_model).

Hey @easbar ,

No, change the spelling didn’t take effect the route as expected. Any other suggestion?

You can’t even provoke an error by using the wrong spelling? Then you probably need to debug if the custom model you set in your request is received on the server side at all. Maybe start in RoureResource.java.