Android max_speed on mobile ( offline)

Hi, I know recently the directions API was upgraded so that the osm “max_speed” tag could be returned with the instructions.
I’m wondering if we can also do the same in java with the android example. https://github.com/graphhopper/graphhopper/tree/master/android
and if so, what steps I need to take

You can use

List<PathDetail> pathDetails = pathWrapper.getPathDetails().get(MaxSpeed.KEY)
1 Like

Brilliant, thank you.

hmmm, actually it’s empty ( null)
the debugger reports pathDetails={HashMap@5694} size=0
I cant see anything like it in the response
even when I manually add max_speed to the config.yml
graph.encoded_values: road_access,max_speed,road_environment,road_class_link,road_class,roundabout

pathwrapper.getdetails().get(MaxSpeed.KEY)
it comes back empty.

Do I need to tell something to add max_speed to the path details some how ?

I thought it might be because Im using 1.0 pre 15 , so I went into config.yml , changed the
Interestingly ,in my testing I found the order of the values in that config string seems to matter, I actually added roundabout and changed the order to reflect the graphhopper set up according to the error message I was getting

and it works, but no max_speed

Since version 1.0-pre10 it is no longer necessary to specify this in the config. But you need to specify which details you need in the request. E.g.:

GHResponse response = gh.route(new GHRequest(51.2492152, 9.4317166, 52.133, 9.1).setPathDetails(Arrays.asList(MaxSpeed.KEY)));
List<PathDetail> list = response.getBest().getPathDetails().get(MaxSpeed.KEY);

Returning all details everytime is not an option as it would increase processing time and response size a lot.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.