[GraphHopper] Reg: GhRequest and handling new params

Peter graphhopper at gmx.de
Wed Jul 8 07:18:31 UTC 2015


Hi Mani,

thanks for the introduction. How to create a custom weighting is
described here
<https://github.com/graphhopper/graphhopper/blob/master/docs/core/weighting.md>
- i.e. extend from the FastestWeighting and return it in
YourCustomGraphHopper.createWeighting. To pass parameters to it you put
them in the hints either via Java:
request.getHints().put("hi", "mani");
or via URL parameters:
&hi=mani

You can then read such custom parameters out in the constructor of your
Weighting as the whole hints map is passed to it at creation time
<https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/GraphHopper.java#L852>.
E.g. like here
<https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/util/FastestWeighting.java#L45>.

Regards,
Peter

On 07.07.2015 21:03, Manikanta Kondeti wrote:
> Hi, 
>
>    This is Manikanta. I've been an avid user/developer in pgrouting.
> After seeing the fastness in graphhopper, I'm pretty much interested
> in understanding it as a user and developer. Also I am basically new
> to Java, hoping its not a problem to learn it as it looks a lot like
> c++. I've read all the docs and I can clearly understand the inner
> underlying techniques which makes it faster. I love the way you guys
> building the graph and also contraction hierarchies stuff though its
> not useful for dynamic graph. 
>
>     Now I want to tweak the code and basically write a new custom
> weighting class. So the first step in doing it is to tweak the
> GhRequest and extend a new class from it or use the same class with
> additional methods and member variables. Can you give me an overview
> of how to proceed? My plan is to take a few(10) params and pass it to
> the custom weighting. Is it possible?  Giving me a reference link
> would help me a lot. Sorry if this is very basic question. Hope you
> understand. 
>
> Thank you,
> Mani 
>     
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20150708/8d244f48/attachment.html>


More information about the GraphHopper mailing list