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?
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.
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).