The Telerik Platform product is retired.Learn more

Filtering within a Polygon

Filtering within a Polygon

Using the Backend Services JavaScript SDK, you can retrieve all content type items that are geographically located within a polygon formed by three or more Geo Points. Telerik Platform supports searches within both concave and convex polygons.

A polygon is specified as an array of points. The last point in the polygon is implicitly connected to the first.

To retrieve all content items that are placed within a polygon use the withinPolygon(field, points) function:

var point1 = new Everlive.GeoPoint(23.317871, 42.687709);
var point2 = new Everlive.GeoPoint(42.698749, 42.698749);
var point3 = new Everlive.GeoPoint(23.331346, 42.702282);

var query = new Everlive.Query();
query.where().withinPolygon("location", [point1, point2, point3]);

// or

var query = new Everlive.Query();
query.where().withinPolygon("location", [[23.317871, 42.687709], [42.698749, 42.698749], [23.331346, 42.702282]]);
Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.