| Forum | GitHub | Maps | Blog

Correct way to enable landmark algorithm


I am debugging why my fastest car with LM always visit much more nodes than your online version. Then I cam across the following example: Same request but one had 675 visited nodes, another had 13858 visited nodes.

First with 675 visits


Second with 13858 visits


I reckon each request hit different server and you might not be able to reproduce this. Just wonder how could this happen?

Start: -37.81361,144.96306
End: -33.86882,151.2093

Edited: Looking at the request now, the only difference is the presence of “ch.disable=true”


With CH you often visit less nodes compared to LM (ch.disable=true). If you disable landmarks too via lm.disable=true (not possible for our online service) you’ll see much more visited nodes (>X00 000)


Ah, my bad. I was thinking too much about my use case (LM is enabled, CH is disabled). So I assumed that for both requests, LM was the default algorithm, hence the presence of “ch.disable=true” didn’t change anything. Thanks for the clarification Peter.


I also stumbled now over the initial problem with “maximumWeight cannot be null”. The reason is that if you have two vehicle profiles and eg. one weighting then weightingsAsStrings.size is 1 and then 1*2=2 weightings will be created via GraphHopper.initLMAlgoFactoryDecorator. But LMAlgoFactoryDecorator.createPreparations cannot handle the second weighting as it had a different name than the first (e.g. fastest_car, fastest_truck).

This is ugly and a current possible workaround is:

class MyGraphHopper {
 public void postProcessing() {
   for (Weighting w : getLMFactoryDecorator().getWeightings()) {
     if (!getLMFactoryDecorator().getWeightingsAsStrings().contains(w.toString()))

Another solution should be to specify the weightings explicitly in the config with the maximumWeight but then fastest_truck is used for car which makes no sense. We have to improve this, likely related to: