Getting road surface details from Custom Model's path.instructions()


The last topic for this was around 2018 and I was curious if there was a simple method to get road surface information via the path or Instructions.
The following suggests that it is possible;

I have setup a custom model with the vehicle set as car. This might be what’s causing the issue…
I have set the following hints;

request.putHint("instructions", true);
request.putHint("calc_points", true);
request.putHint("points_encoded", false);

I get the best route.
I output the instructions to see what’s happening with them;
[(0,Elsie Morton Place,211.15076130108702,25338), (-2,Dominion Road,62.121,4970), (2,,68.593,12347), (4,,0.0,0)]

Am I missing something simple?

List<String> details = new ArrayList();

new GHRequest(flat, flon, tlat, tlon).setPathDetails(details);

This then gives road_class details from System.out.println(path.getPathDetails());

Optional parameter to retrieve path details. You can request additional details for the route: street_name, time, distance, max_speed, toll, road_class, road_class_link, road_access, road_environment, lanes, and surface

Yes, you can do the same with “surface”. You just answered your own question, didn’t you?

Haha :slight_smile:
Yes, I got stuck but then revisited it a few hours later and it just sort of clicked.
Figured I would answer my own question instead of removing it just in case someone searches for a similar thing.

1 Like