Load custom weights from multiple external sources

I was wondering which is the best strategy to load custom weights from multiple sources. In other words, I have a set of files that associate OSM ids with custom weights, the goal would be to load them in addition to the standard OSM data.

For example let’s imagine that I have a map between OSM wayID -> custom_weight_1 and I want to make available to my weighting class, let’s say an extension of the FastestWeighting, not only the speed but also the custom_weight_1 for each edge. How should I approach the problem?

Thanks!

Thanks a lot for the quick answer. Loading the customized weights should be done modifying the OSMReader class or is there a better approach?

(sorry for the naive questions!)

Do you mean I should open and load my custom csv file with the pairs (osm_wayid_1, custom_weight_1) in the Weighting class?

thanks for the tip! I got the pipeline almost working creating a custom weighting and a custom FlagEncoder where I load the custom weights from a file. The problem is that I couldn’t find a lot of information on how to encode correctly these weights without messing up with the weights that are already there.

For example, I extended the FootFlagEncoder and I would like to add a double to an edge flags, how should I approach the problem (e.g., how I deal the offset and similar). Do you know of any detailed tutorial/working example on this?

Thanks!

Thanks a lot for your help, I still have a lot to learn and bits that I don’t fully understand, but I managed to make it work! :wink:

1 Like
Powered by Discourse