diff --git a/app/datastore/AgencyTx.java b/app/datastore/AgencyTx.java index c9fec9dc..a964f1e1 100644 --- a/app/datastore/AgencyTx.java +++ b/app/datastore/AgencyTx.java @@ -287,20 +287,35 @@ public Collection getStopsWithinBoundingBox (double north, double east, do Tuple2 min = new Tuple2(west, south); Tuple2 max = new Tuple2(east, north); - Set, String>> matchedKeys = - stopsGix.subSet(new Tuple2(min, null), new Tuple2(max, Fun.HI)); - - Collection matchedStops = - Collections2.transform(matchedKeys, new Function, String>, Stop> () { - - @Override - public Stop apply( - Tuple2, String> input) { - return stops.get(input.b); - } - }); + Set, String>> matchedKeys + = stopsGix.subSet(new Tuple2(min, null), new Tuple2(max, Fun.HI)); + + List matchedStops = new ArrayList(); + + for (Tuple2, String> value : matchedKeys) { + Tuple2 lonLat = value.a; + if (lonLat.a >= west && + lonLat.a <= east && + lonLat.b >= south && + lonLat.b <= north + ) { + Stop mStop = stops.get(value.b); + matchedStops.add(mStop); + } + } + + /* + Collection matchedStops + = Collections2.transform(matchedKeys, new Function, String>, Stop>() { + + @Override + public Stop apply( + Tuple2, String> input) { + return stops.get(input.b); + } + });*/ - return matchedStops; + return matchedStops; } public Collection getTripPatternsByStop (String id) { @@ -480,4 +495,4 @@ public Tuple2 apply(Tuple2 throw new RuntimeException(e); } } -} \ No newline at end of file +}