TomH
TomH

Reputation: 2990

Graphhopper: Adding weight to edges using OSM id

I have a pbf file of the greater Chicago area and have been able to load this file using the graphhopper web viewer.

I would like to improve bike routing using additional usage data that I have for road segments (each identified by an OSM id).

From this SO answer how-to-quickstart-graphhopper-with-my-own-multimodal-graph, I understand that I will need to feed the usage data I have into the GraphHopperStorage. A few questions about doing so:

1) My usage data references OSM ids. How do I reference edges in my pbf file to an OSM id? I also have the lat/lon coordinates of the head/tail of each segment -- from what I've read, I believe that I will have to use these for my mapping?

2) Once I have created MyGraphHopperStorage, can I persist the addition of the weighting so that I do not have to perform this at every run?

Thanks

tom

Upvotes: 2

Views: 940

Answers (1)

Karussell
Karussell

Reputation: 17375

My usage data references OSM ids. How do I reference edges in my pbf file to an OSM id?

You'll need to keep a (Hash)Map while import for convert between internal and OSM IDs (either edge or node). To keep using osm id even after the import see this example project

can I persist the addition of the weighting so that I do not have to perform this at every run?

You can store this into the flags and call graph.flush, see my recent traffic data post

Upvotes: 3

Related Questions