tl;dr:
I need all nodes in a certain area. I’m new to Graphhopper and I believe a LocationIndex and its query
method is the way to go.
I got all edges (as ints) in an area, but how do I get their nodes?
val hop: GraphHopper = …
val index = hop.getLocationIndex()
val visitor: Visitor = (edge: Int) => {
println(edge)
}
index.query(new BBox(…), visitor)
Resources I looked at:
- I looked at EdgeExplorer, but that needs a node and gives you edges that connect to it. I need the other way around.
- I also looked at
hop.getGraphHopperStorage().getEdgeIteratorStateForKey(123)
but I get back edges from the query, not edge keys. - There is, of course, the brute force way detailed in How to get EdgeIteratorState from EdgeID - #4 by easbar, that is iterating through all edges of the entire graph and picking put the ones with matching IDs. However, I really hope there is a faster solution.
So: How do I get the connecting nodes of an edge or set of edges? Is there no HashMap from edge ID to EdgeIteratorState?