The Telerik Platform product is retired.Learn more

Filtering Near a Point

Filtering Near a Point

Using the Backend Services JavaScript SDK, you can filter a content type that contains a Geo Point to get all content items that are near it. The result items are ordered by distance and are always limited to 100 items. If you need to return more than 100 items, use withinCenterSphere.

var el = new Everlive('your-app-id');
var query = new Everlive.Query();
query.where().nearSphere('Location', new Everlive.GeoPoint(23.379068, 42.650601));
var data ='type-name');

The nearSphere(field, point, distance, metrics) function takes the name of the field with geo points, a GeoPoint represented by an Everlive.GeoPoint instance, a plain object, or an array of numbers (see the previous section about GeoPoint values), an optional number for maximum distance, an optional string representing the metrics for the max distance argument: 'radians' for radians, 'km' for kilometers, 'miles' for miles. If the metrics are omitted the default value is 'radians'. The results will still be ordered by distance from the given GeoPoint.

var query = new Everlive.Query();
query.where().nearSphere('Location', [23.379068, 42.650601], 100, 'km');

The distances in kilometers and miles are applicable only for Earth coordinates as they take into account the Earth's radius.

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