The Telerik Platform product is retired.Learn more

Filtering within a Circle

Filtering within a Circle

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.

Filtering within a circle with radius in kilometers

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');

The 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 radians.

The difference between withinCenterSphere and 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.

Caveat with withinCenterSphere At the moment Telerik Platform does not support queries that wrap at the poles. This is especially evident with withinCenterSphere. If a wrapping occurs with withinCenterSphere a null result will be returned.

Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.