Wanted to share some of my code I use to get all possible routes from a random geopoint in osm2po.
Graph graph = loadGraph();
OverlayNode node = new OverlayNode(lat, lon);
if (node.snap(graph, (int[])null)) {
List<Integer> edges = new LinkedList<>();
edges.add(node.getEdgeIdx());
int reverseId = graph.findReverseEdge(node.getEdgeIdx());
if (reverseId > 0) {
edges.add(reverseId);
}
for (int edgeIdx : edges) {
routeFrom(edgeIdx);
}
}
Seems to work like I want to work (only getting the reverse edge if it's drivable) - but is this the correct way to do this or is there already a method that will give me all edges for a given point?