[GraphHopper] GH 0.1 -> 0.1.1 code update

Peter K peathal at yahoo.de
Sat Oct 5 14:13:21 UTC 2013


yes, around 8%. Also think about using jdk8 which is additional 10% faster.

Regards,
Peter.

> Thank you!
>
> Is there a measureble improvement in routing speed between gh v0.1 -
> v0.2? I would like to calculate about 4 000 000 distances and it takes
> some time :).
>
> Dne 5.10.2013 11:41, Peter K napsal(a):
>> Hi Andy,
>>
>> the exception is a bit misleading and I will fix this to show the real
>> problem.
>>
>> You have to use importOrLoad instead of load otherwise there won't be
>> files to use for graphhopper. Also you should set the encoding manager
>> BEFORE calling importOrLoad, there are cases where you don't need to
>> specify it but setting it afterwards is wrong (I'll implement also a fix
>> to avoid those problems). For some good and bad examples have a look
>> into GraphHopperTest.
>>
>> Regards,
>> Peter.
>>
>>> Hello!
>>>
>>> I would like to use GH for measuring distance in my offline desktop
>>> app. Long time ago I used some 0.1 snaphot and wrote this little piece
>>> of code:
>>>
>>>          double fromLat = 50.216493, fromLon = 15.814353, toLat =
>>> 50.105043, toLon = 14.389708;
>>>
>>>          GraphHopperAPI gh = new GraphHopper().setInMemory(true, true);
>>>          gh.load("C:\\OSM\\streets.osm");
>>>          GHRequest request = new
>>> GHRequest(fromLat,fromLon,toLat,toLon);
>>>          request.algorithm("astar");
>>>          GHResponse response = gh.route(request);
>>>
>>>          System.out.println("Distance: " + response.distance());
>>>
>>> And it worked! But now i would like to use snaphot 0.1.1
>>> (https://oss.sonatype.org/content/groups/public/com/graphhopper/graphhopper-parent/).
>>>
>>> I reworked the code like this:
>>>
>>>          double fromLat = 50.216493, fromLon = 15.814353, toLat =
>>> 50.105043, toLon = 14.389708;
>>>
>>>          GraphHopper gh = new
>>> GraphHopper().forDesktop().setInMemory(true, true);
>>>          gh.setOSMFile("C:\\OSM\\streets.osm");
>>>          gh.load("C:\\OSM\\");
>>>          EncodingManager ecn = new EncodingManager("CAR");
>>>          gh.setEncodingManager(ecn);
>>>          GHRequest request = new
>>> GHRequest(fromLat,fromLon,toLat,toLon);
>>>          GHResponse response = gh.route(request);
>>>
>>>          System.out.println("Distance: " + response.getDistance());
>>>
>>> I guess it´s awfully wrong, because it´s not working (I am getting
>>> null pointer ex in gh.route()). Can you help me fix this please?
>>>
>>> Andy
>>>




More information about the GraphHopper mailing list