[GraphHopper] Reg: GhRequest and handling new params
Peter
graphhopper at gmx.de
Thu Jul 9 07:13:21 UTC 2015
Hi Mani,
this should be easy if you use the HTTP communication ('pseudo REST'):
1. start the server, which makes the web api
<https://github.com/graphhopper/graphhopper/blob/master/docs/web/api-doc.md>
available on localhost:8989
2. in node.js you can then e.g. (re)use the separate client in
javascript from here
<https://github.com/graphhopper/directions-api-js-client> but have not
tested it in node.js only within the browser
Regards,
Peter
PS: please when replying the mailinglist emails make sure your answers
go to graphhopper at openstreetmap.org instead of the personal email
On 09.07.2015 01:37, Manikanta Kondeti wrote:
> Hi Peter,
>
> Thanks a lot for the reply. I am writing a small application where the
> backend is in Node js. I want to create a bridge communication between
> routing engine (graphhopper which is in java) and server code(node
> js). I've found a node lib node-java-maven which helps to create tht
> communication but I am not sure how. Is it possible? If yes how do I
> start. I am basically new to Java and trying to figure out Java
> frameworks. Summary is I am trying to create client, server in node-js
> and basically want to pass the params to server, server-
> java(graphhopper), calculate route and send it back. I want to
> understand that communication between java and node. What are your
> thoughts on it? Your advice will help me a lot.
>
> Thanks,
> Mani
>
> On Wed, Jul 8, 2015 at 12:48 PM, Peter <graphhopper at gmx.de
> <mailto:graphhopper at gmx.de>> wrote:
>
> 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
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20150709/9e4d316c/attachment.html>
More information about the GraphHopper
mailing list