You can retrieve all content type items that are located within a circle with a radius in either kilometers, miles, or radians. To create this type of query, use the
withinCenterSphere(field, center, radius, metrics) function.
To retrieve all content items that are placed within a circle with radius 5 kilometers execute the following query:
var query = new Everlive.Query(); query.where().withinCenterSphere('Location', new Everlive.GeoPoint(23.317871, 42.687709), 5, 'km');
withinCenterSphere() function takes four arguments: the name of the field with geo points, a geo point representing the center of the circle, a number for the radius of the circle, an optional string
representing the metrics for the radius argument:
radians for radians,
km for kilometers,
miles for miles. If the metrics are omitted the default value is
The difference between
nearSphere queries is that
withinCenterSphere doesn't return the results ordered by distance from the center point, whereas
nearSphere does. This makes
withinCenterSphere the favorable choice when performance is a priority.
withinCenterSphereAt the moment Telerik Platform does not support queries that wrap at the poles. This is especially evident with
withinCenterSphere. If a wrapping occurs with
nullresult will be returned.