/// <summary> /// Adds a proximity-based constraint for finding objects with keys whose GeoPoint /// values are near the given point. /// </summary> /// <param name="key">The key that the ParseGeoPoint is stored in.</param> /// <param name="point">The reference ParseGeoPoint.</param> /// <returns>A new query with the additional constraint.</returns> public ParseQuery <T> WhereNear(string key, ParseGeoPoint point) { return(new ParseQuery <T>(this, @where: new Dictionary <string, object> { { key, new Dictionary <string, object> { { "$nearSphere", point } } } })); }
/// <summary> /// Adds a proximity-based constraint for finding objects with keys whose GeoPoint /// values are near the given point and within the maximum distance given. /// </summary> /// <param name="key">The key that the ParseGeoPoint is stored in.</param> /// <param name="point">The reference ParseGeoPoint.</param> /// <param name="maxDistance">The maximum distance (in radians) of results to return.</param> /// <returns>A new query with the additional constraint.</returns> public ParseQuery <T> WhereWithinDistance( string key, ParseGeoPoint point, ParseGeoDistance maxDistance) { return(new ParseQuery <T>(WhereNear(key, point), @where: new Dictionary <string, object> { { key, new Dictionary <string, object> { { "$maxDistance", maxDistance.Radians } } } })); }
/// <summary> /// Add a constraint to the query that requires a particular key's coordinates to be /// contained within a given rectangular geographic bounding box. /// </summary> /// <param name="key">The key to be constrained.</param> /// <param name="southwest">The lower-left inclusive corner of the box.</param> /// <param name="northeast">The upper-right inclusive corner of the box.</param> /// <returns>A new query with the additional constraint.</returns> public ParseQuery <T> WhereWithinGeoBox(string key, ParseGeoPoint southwest, ParseGeoPoint northeast) { return(new ParseQuery <T>(this, @where: new Dictionary <string, object> { { key, new Dictionary <string, object> { { "$within", new Dictionary <string, object> { { "$box", new[] { southwest, northeast } } } } } } })); }