Adding OSM node&way ID's to JSON


I am slowly getting my head around graphhoper – thanks for all the amazing hard work - what a great community, this forum is amazing.

I am wanting to parse the JSON directions file to further enrich directions with more information from OSM and other data sources. At the moment I am looking at each lat/long pair to find the OSM node and Way ID’s to then look up the extra info I want to include. But this is prone to error and is pretty slow.

How can I get the Graphhopper API to include the list of all the OSM Node ID’s, and Way ID’s in the outputted JSON??

I have seen this, but not sure how to practically use it (sorry I am very new to graphhoper and Java)


Matt :slight_smile:

Hi Matt,

have you also looked at the code that is referenced in the other post? This should show you how to store the ids.

Adding them to the Json is actually quite easy, once you can store them in the graph. I am currently working on this PR, which should be merged very soon. The PR shows how to add average speed to the json result. However for way IDs this should work very similar. Adding this for node IDs is a bit more tricky, but once you got that far, I think you will understand how to do this for nodes as well :), Otherwise, don’t hesitate to ask.


1 Like

Awesome – thanks Robin, I think your PR is the missing link for me.
I will give it a go.

Thanks again – fantastic help.

Matt :slight_smile: