GraphHopper.com | Forum | GitHub | Maps | Blog

Remove a weighting dynamically from Algorithm Options?


#1

Is it possible to remove a custom weighting while supplying the algoOpts to the createAlgo method? Where should I be looking to customise this if it doesn’t exist already?


#2

I don’t really understand the question, but you should be able to extend GraphHopper to do almost everything you want. I would probably start at the createAlgo method or the place where this method gets called.

Cheers,
Robin


#3

This is my calcPaths method where I can dynamically add a weigthing to my algoOpts,

AvoidEdgesWeighting avoidPathWeighting = new AvoidEdgesWeighting(algoOpts.getWeighting());
	avoidPathWeighting.setEdgePenaltyFactor(5);
	algoOpts = AlgorithmOptions.start(algoOpts).algorithm(Parameters.Algorithms.ASTAR_BI)
			.weighting(avoidPathWeighting).build();

Now what if my want to remove a weighting instead of adding?


#4

I think I figured it out. Instead of adding the weighting all at once I can add the weighting only when needed just like the
createTurnWeighting method.in the Graphhopper class