Load additional data from pbf file while importing

I need to import all bus stops nodes (highway=bus_stop for example) from a pbf file in addition to loading all the roadmap that GraphHopperOsm usually does.
Pereferably, I’d like to save it in the GraphHopperStorage.
Is it possible?
If not, how can I use the OSMReader class or something in order to get all nodes with that attribute?

Thanks!

I did the exact same fing for a university projekt.
I dont’t know if it is possible with graphhopper but You can do it with your own OSMReader. Just getting started with graphhopper

Implement org.openstreetmap.osmosis.core.task.v0_6.Sink; This allows you to process every entity in the pbf. You than can go through all the Tags of evry node and check for bus_stop and save it somewhere.

Than use OsmosisReader(new FileInputStream(FILE)).setSink(YOUR_SINK).run();

hope that helps. Graphhopper uses the same way to create the graph

Hi, thanks for answering!
I actually decided to download the needed data using overpass api. much easier.
But theoretically, I could duplicate what OSMReader does (it uses OSMInput), but that would require processing the file twice… there’s no way to infiltrate the reading process.
About storing it, I realized I could create a GraphHopperStorage and then set the node information for each node. This way, I can even have LocationIndex to help get a list of bus station within a certain area.

I hope both of our answers would of use for someone.

I do not know much about Java. So, just wondering where to add and where to implement

“org.openstreetmap.osmosis.core.task.v0_6.Sink”
“OsmosisReader(new FileInputStream(FILE)).setSink(YOUR_SINK).run()”

And do you have any idea if I want to calculate the capacity of an edge (that requires speed and lane information) how i can do that? some of the edges do not have any speed or lane information. and also, is there any way to edit the pbf file so that I can use my updated lane and speed information?

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