@@ -182,6 +182,57 @@ class QueryBuilder<T extends ParseObject> {
182182 if (orderByScore) orderByDescending ('score' );
183183 }
184184
185+ /// Returns an objects with key point values near the point given
186+ void whereNear (String column, ParseGeoPoint point) {
187+ var latitude = point.latitude;
188+ var longitude = point.longitude;
189+ queries.add (MapEntry (_SINGLE_QUERY ,
190+ '\" $column \" :{\"\$ nearSphere\" :{\" __type\" :\" GeoPoint\" ,\" latitude\" :$latitude ,\" longitude\" :$longitude }}' ));
191+ }
192+
193+ /// Returns an object with key point values near the point given and within the maximum distance given.
194+ void whereWithinMiles (
195+ String column, ParseGeoPoint point, double maxDistance) {
196+ var latitude = point.latitude;
197+ var longitude = point.longitude;
198+
199+ queries.add (MapEntry (_SINGLE_QUERY ,
200+ '\" $column \" :{\"\$ nearSphere\" :{\" __type\" :\" GeoPoint\" ,\" latitude\" :$latitude ,\" longitude\" :$longitude },\"\$ maxDistanceInMiles\" :$maxDistance }' ));
201+ }
202+
203+ /// Returns an object with key point values near the point given and within the maximum distance given.
204+ void whereWithinKilometers (
205+ String column, ParseGeoPoint point, double maxDistance) {
206+ var latitude = point.latitude;
207+ var longitude = point.longitude;
208+
209+ queries.add (MapEntry (_SINGLE_QUERY ,
210+ '\" $column \" :{\"\$ nearSphere\" :{\" __type\" :\" GeoPoint\" ,\" latitude\" :$latitude ,\" longitude\" :$longitude },\"\$ maxDistanceInKilometers\" :$maxDistance }' ));
211+ }
212+
213+ /// Returns an object with key point values near the point given and within the maximum distance given.
214+ void whereWithinRadians (
215+ String column, ParseGeoPoint point, double maxDistance) {
216+ var latitude = point.latitude;
217+ var longitude = point.longitude;
218+
219+ queries.add (MapEntry (_SINGLE_QUERY ,
220+ '\" $column \" :{\"\$ nearSphere\" :{\" __type\" :\" GeoPoint\" ,\" latitude\" :$latitude ,\" longitude\" :$longitude },\"\$ maxDistanceInRadians\" :$maxDistance }' ));
221+ }
222+
223+ /// Returns an object with key point values contained within a given rectangular geographic bounding box.
224+ void whereWithinGeoBox (
225+ String column, ParseGeoPoint southwest, ParseGeoPoint northeast) {
226+ var latitudeS = southwest.latitude;
227+ var longitudeS = southwest.longitude;
228+
229+ var latitudeN = northeast.latitude;
230+ var longitudeN = northeast.longitude;
231+
232+ queries.add (MapEntry (_SINGLE_QUERY ,
233+ '\" $column \" :{\"\$ within\" :{\"\$ box\" : [{\" __type\" : \" GeoPoint\" ,\" latitude\" :$latitudeS ,\" longitude\" :$longitudeS },{\" __type\" : \" GeoPoint\" ,\" latitude\" :$latitudeN ,\" longitude\" :$longitudeN }]}}' ));
234+ }
235+
185236 /// Finishes the query and calls the server
186237 ///
187238 /// Make sure to call this after defining your queries
0 commit comments