Hi
I am kind of lost… Can someone please help me with how I can get the OSM way ids?
Previously I retrieved the osm-way-ids from the path details (after adding to the encoded values in config)…
**hopper.setEncodedValuesString("osm_way_id");**
hopper.getCHPreparationHandler().setCHProfiles(new CHProfile("car"));
hopper.importOrLoad();
return hopper;
}
public static void routing(GraphHopper hopper) {
GHRequest req = new GHRequest(38.97283745, -77.06720901,38.94379886, -77.06623885).
setProfile("car").
setPathDetails(Arrays.asList("osm_way_id")).
setLocale(Locale.US);
GHResponse rsp = hopper.route(req);
// handle errors
if (rsp.hasErrors())
throw new RuntimeException(rsp.getErrors().toString());
ResponsePath path = rsp.getBest();
Map<String, List<PathDetail>> details = path.getPathDetails();
But Now it says it cannot find the osm-way-ids in path details. Where did the osm-way-ids go? How can I retrive those now?
easbar
October 18, 2023, 10:41am
2
What do you mean you it worked previously? Maybe you ran a new import and forgot to add the osm_way_id this time? Or you are using another -gh folder now?
Previously it worked. But now, after I delete the gh folder and ran it again (with osm-way-id in encoded values), it gives me this error. Don’t understand why… in the config file, osm-way-id is there
But in the docs why it does not show it?
# Custom Models
GraphHopper provides an easy-to-use way to customize its route calculations: Custom models allow you to modify the
default routing behavior by specifying a set of rules in JSON language. Here we will first explain some theoretical
background and then show how to use custom models in practice.
Try some live examples in [this blog post](https://www.graphhopper.com/blog/2020/05/31/examples-for-customizable-routing/)
and the [custom_models](../../custom_models) folder on how to use them on the server-side.
## How GraphHopper's route calculations work
One of GraphHopper's most important functionality is the calculation of the 'optimal' route between two locations. To do
this, GraphHopper subdivides the entire road network into so called 'edges'. Every edge represents a certain road
segment between two junctions. Therefore finding the optimal route between two locations means finding the optimal
sequence of edges that connect the two locations. GraphHopper stores certain attributes (so called 'encoded values') for
every edge and applies a formula (the so called 'weighting') to calculate a numeric 'weight' for every edge. The total
weight of a route is the sum of all the edge's weights. The optimal route is the one where the total weight is the
smallest.
For example you can imagine the edge weight to be the time you need to travel from one junction to another. Finding the
This file has been truncated. show original
easbar
October 18, 2023, 4:23pm
4
The configuration you are showing here is all commented out.
Oh… i just copied that from online. here is my config. Also, I put 0 for distance influence, that means it should only take fastest route right?
easbar
October 18, 2023, 5:11pm
6
You need
graph.encoded_values: osm_way_id
not
graph:
encoded_values: osm_way_id
Oh thank you. Silly me. However, another thing just happened. If I add more attributes with/wo space after comma, it gives me same error.
easbar
October 18, 2023, 6:27pm
9
without the space it should work
I tried without space. However, I basically need the osm-ids for now, so it is fine.
I have another question here How the speed is calculated during routing . I am trying to understand the purpose of CarAverageSpeedParser. Could you please help me with the question? The speed map in CarAverageSpeedParser are the speeds that calculate the weights of links for calculating a route?
Thank you so much