Filtering within a Rectangle

Filtering within a Rectangle

You can retrieve all content type items that are geographically located within a rectangle formed by a pair of Geo Points—bottom left and top right corner, in that order.

To retrieve all content items that are within a rectangle formed by two geo points (an array of the bottom left and top right points) execute the following query:

//Ajax request using jQuery
 var filter = {
    "Location": {
        "$within": {
            "$box": [{ "longitude": 22.317871, "latitude": 41.687709 }, //bottom left point as first element
                { "longitude": 24.331346, "latitude": 43.707075 }] //top right point as second element
        }
    }
};

$.ajax({
    url: 'https://api.everlive.com/v1/your-app-id/type-name',
    type: "GET",
    headers: {
        "Authorization" : "Bearer your-access-token-here",
        "X-Everlive-Filter" : JSON.stringify(filter)
    },
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
})
Request:
    GET https://api.everlive.com/v1/your-app-id/type-name
Header:
    Authorization  Bearer your-access-token-here
    X-Everlive-Filter {
        "Location": {
            "$within": {
                "$box": [{ "longitude": 22.317871, "latitude": 41.687709 },
                    { "longitude": 24.331346, "latitude": 43.707075 }]
            }
        }
    }
Response:
    Status: 200 OK
    Content-Type: application/json
Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.