Possible to disable alternative routes in the web UI?

Hello,

We’re using a specific weighting algorithm within the GraphHopper routing engine (for heavy vehicle routing considerations).

We’ve run into some issues with the GH web UI showing a different primary route compared to what the routing engine will actually return with our specific weighting.

Is there a way to configure the UI so it doesn’t request the alternative routes to avoid this?

Thanks,
David

I don’t think this is possible using the configuration, but in the graphhopper-maps source code there is a maxAlternativeRoutes Parameter that you could set to 1.

Hi @easbar, thanks for the reply. Is this something that would be possible to add as a configuration option to the product in some way?

There are no plans to do this but you can easily change the code (fork it).

Actually there is already a very flexible mechanism that allows you to override arbitrary parameters of the routing request: here. The only thing that really prevents one from disabling the alternative routes currently is that the algorithm field is overwritten. If we added something like (profileConfig.algorithm && profileConfig.algorithm !== 'alternative_route') (and maybe the same for config.request) it should work. I think it would be reasonable to make this change also in main graphhopper-maps?

Actually I had a second look and the alternative routing request needs to be prevented at an earlier stage. This is how we could make it configurable: GitHub - graphhopper/graphhopper-maps at config_max_alternatives (I still think this would be a reasonable addition).

ok.