I'm trying to get all street segments out of osm2po graph, given a geo point and a certain radius. Right now I just do a breadth first search out of the street that's closest to my point, but is there a better way?
class AreaIterator implements Iterator { private Set visited = new HashSet(); private List queue = new LinkedList(); private final Graph graph; private final GeoPoint center; private final float radius; private final boolean twoSided; public AreaIterator(Graph graph, GeoPoint center, float radius) { this.graph = graph; this.center = center; this.radius = radius; List edges = getEdgesForPoint((float) center.lat(), (float) center.lon(), graph); queue.addAll(edges); } private int step() { int edgeIdx = 0; if (!queue.isEmpty()) { edgeIdx = queue.remove(0); DirectedStreet street = getDirectedStreetFromEdgeIdx(graph, edgeIdx); if (!visited.contains(edgeIdx)) { visited.add(edgeIdx); if (street.getGeom().distance(center.getGeom())
class AreaIterator implements Iterator { private Set visited = new HashSet(); private List queue = new LinkedList(); private final Graph graph; private final GeoPoint center; private final float radius; private final boolean twoSided; public AreaIterator(Graph graph, GeoPoint center, float radius) { this.graph = graph; this.center = center; this.radius = radius; List edges = getEdgesForPoint((float) center.lat(), (float) center.lon(), graph); queue.addAll(edges); } private int step() { int edgeIdx = 0; if (!queue.isEmpty()) { edgeIdx = queue.remove(0); DirectedStreet street = getDirectedStreetFromEdgeIdx(graph, edgeIdx); if (!visited.contains(edgeIdx)) { visited.add(edgeIdx); if (street.getGeom().distance(center.getGeom())