You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _includes/js/geopoints.md
+36-2Lines changed: 36 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,40 @@ query.find({
40
40
41
41
At this point `placesObjects` will be an array of objects ordered by distance (nearest to farthest) from `userGeoPoint`. Note that if an additional `ascending()`/`descending()` order-by constraint is applied, it will take precedence over the distance ordering.
42
42
43
-
To limit the results using distance, check out `withinMiles`, `withinKilometers`, and `withinRadians`.
43
+
To limit the results using distance, check out `withinMiles`, `withinKilometers`, and `withinRadians`. Use the `sorted` parameter to sort the results by distance ascending.
44
+
45
+
<pre><codeclass="javascript">
46
+
var location = new Parse.GeoPoint(37.708813, -122.526398);
It's also possible to query for the set of objects that are contained within a particular area. To find the objects in a rectangular bounding box, add the `withinGeoBox` restriction to your `Parse.Query`.
46
79
@@ -95,4 +128,5 @@ At the moment there are a couple of things to watch out for:
95
128
96
129
1. Each Parse.Object class may only have one key with a Parse.GeoPoint object.
97
130
2. Using the `near` constraint will also limit results to within 100 miles.
98
-
3. Points should not equal or exceed the extreme ends of the ranges. Latitude should not be -90.0 or 90.0. Longitude should not be -180.0 or 180.0. Attempting to set latitude or longitude out of bounds will cause an error.
131
+
3. Using the `near` constraint combined with an `ascending` or `descending` constraint is not recommended due to performance. This is because `$near` sorts objects by distance and an additional sort constraint re-orders the matching objects, effectively overriding the sort operation already performed.
132
+
4. Points should not equal or exceed the extreme ends of the ranges. Latitude should not be -90.0 or 90.0. Longitude should not be -180.0 or 180.0. Attempting to set latitude or longitude out of bounds will cause an error.
0 commit comments