* TODO replace with an on-street search using the existing profile router functions.
*/
public Map<StopCluster, Double> findNearbyStopClusters (StopCluster sc, double radius) {
Map<StopCluster, Double> ret = Maps.newHashMap();
Envelope env = new Envelope(new Coordinate(sc.lon, sc.lat));
env.expandBy(SphericalDistanceLibrary.metersToLonDegrees(radius, sc.lat),
SphericalDistanceLibrary.metersToDegrees(radius));
for (StopCluster cluster : stopClusterSpatialIndex.query(env)) {
// TODO this should account for area-like nature of clusters. Use size of bounding boxes.
double distance = distlib.distance(sc.lat, sc.lon, cluster.lat, cluster.lon);
if (distance < radius) ret.put(cluster, distance);