/glayer/objects_in_radius

POST

Список объектов, попавших в радиус

Получение списка объектов из слоя, которые находятся в каком-то радиусе от заданной точки.

Также поддерживает параметры limit, offset.

Headers

ccode
text
request_user_007
CCODE - (Client Code) - Обязательный параметр. Это идентификатор клиента в свободной форме. Он нужн для того, чтобы понять, кто именно выполнил запрос. Обычно, если API пользуются несколько пользователей, то сюда указывают ID пользователя, например, user_56748 Если так сделать, то мы сможем по логам понять, например, кто именно настрелял слишком много запросов
key
text
dd83e51f-6d0a-4510-a885-6b54e5881961
Обязательный параметр. Ключ доступа к API. Этот ключ даёт доступ лишь к демонстрационному датасету и набору функций. Реальный ключ выдается при оформлении платной подписки на Geointellect

Body

URLENCODED
layerid
101
ID слоя
xlon
37.517023
Долгота (в десятичных градусах)
ylat
55.662627
Широта (в десятичных градусах)
size
2500
Размер радиуса в метрах
where
int people > 100
Фильтр в формате [тип поле оператор значение]. Типы бывают: text, int, double. Операторы бывают: =, !=, >, <, >=, <=, in, like. Все части чувствительны к регистру, то есть "Year" и "year" это разные слова.
where
text Walls like панельные
Примеры запросов
curl -X POST \
  -L 'https://api.geointellect.com/glayer/objects_in_radius' \
  -H 'ccode: request_user_007' \
  -H 'key: dd83e51f-6d0a-4510-a885-6b54e5881961' \
  --data-urlencode 'layerid=101' \
  --data-urlencode 'xlon=37.517023' \
  --data-urlencode 'ylat=55.662627' \
  --data-urlencode 'size=2500' \
  --data-urlencode 'where=int+people+%3e+100' \
  --data-urlencode 'where=text+Walls+like+%d0%bf%d0%b0%d0%bd%d0%b5%d0%bb%d1%8c%d0%bd%d1%8b%d0%b5'  \
  -v
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;

public class Program
{
    public static async Task Main(string[] args)
    {
        var client = new HttpClient();
        var request = new HttpRequestMessage(HttpMethod.Post, "https://api.geointellect.com/glayer/objects_in_radius");
        request.Headers.Add("ccode", "request_user_007");
        request.Headers.Add("key", "dd83e51f-6d0a-4510-a885-6b54e5881961");
        
        var collection = new List<KeyValuePair<string, string>>();
        collection.Add(new("layerid", "101"));
        collection.Add(new("xlon", "37.517023"));
        collection.Add(new("ylat", "55.662627"));
        collection.Add(new("size", "2500"));
        collection.Add(new("where", "int people > 100"));
        collection.Add(new("where", "text Walls like панельные"));
        
        var data = new FormUrlEncodedContent(collection);
        
        request.Content = data;
        var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
import requests
import json

url = "https://api.geointellect.com/glayer/objects_in_radius"

headers = {
    'ccode': 'request_user_007',
    'key': 'dd83e51f-6d0a-4510-a885-6b54e5881961',
}

# URL-encoded form data
data = {
    'layerid': '101',
    'xlon': '37.517023',
    'ylat': '55.662627',
    'size': '2500',
    'where': 'int people > 100',
    'where': 'text Walls like панельные',
}

response = requests.post(url, headers=headers, data=data)

# Check response and print result
response.raise_for_status()
print(response.text)
const headers = {
  'ccode': 'request_user_007',
  'key': 'dd83e51f-6d0a-4510-a885-6b54e5881961',
};

const options = {
  method: 'POST',
  headers: headers,
  body: new URLSearchParams({
    'layerid': '101',
    'xlon': '37.517023',
    'ylat': '55.662627',
    'size': '2500',
    'where': 'int people > 100',
    'where': 'text Walls like панельные',
  }),
};

fetch('https://api.geointellect.com/glayer/objects_in_radius', options)
  .then(response => {
    if (!response.ok) {
      throw new Error('HTTP error ' + response.status);
    }
    return response.json();
  })
  .then(data => console.log('Success:', data))
  .catch(error => console.error('Error:', error));
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
    "net/url"
)

func main() {
    client := &http.Client{
    }

    baseUrl := "https://api.geointellect.com/glayer/objects_in_radius"
    fullUrl := baseUrl

    formData := url.Values{
        "layerid": {"101"},
        "xlon": {"37.517023"},
        "ylat": {"55.662627"},
        "size": {"2500"},
        "where": {"int people > 100"},
        "where": {"text Walls like панельные"},
    }
    req, err := http.NewRequest("POST", fullUrl, strings.NewReader(formData.Encode()))
    if err != nil {
        panic(err)
    }

    // Set headers
    req.Header.Set("ccode", "request_user_007")
    req.Header.Set("key", "dd83e51f-6d0a-4510-a885-6b54e5881961")
    req.Header.Set("Content-Type", "application/x-www-form-urlencoded")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println("Status:", resp.Status)
    fmt.Println("Response:", string(body))
}
// Add to Cargo.toml dependencies:
// [dependencies]
// reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1.0", features = ["full"] }
// serde = { version = "1.0", features = ["derive"] }
// serde_json = "1.0"

use reqwest::Client;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client = Client::new();

    // Build URL
    let mut url = "https://api.geointellect.com/glayer/objects_in_radius".to_string();

    // Build request
    let mut request = client.post(&url);

    // Add headers
    request = request.header("ccode", "request_user_007");
    request = request.header("key", "dd83e51f-6d0a-4510-a885-6b54e5881961");

    // Add URL encoded data
    let mut form = HashMap::new();
    form.insert("layerid", "101");
    form.insert("xlon", "37.517023");
    form.insert("ylat", "55.662627");
    form.insert("size", "2500");
    form.insert("where", "int people > 100");
    form.insert("where", "text Walls like панельные");
    request = request.form(&form);

    // Send request
    let response = request.send().await?;

    // Check status
    if !response.status().is_success() {
        eprintln!("Request failed with status: {}", response.status());
        return Ok(());
    }

    // Read response
    let body = response.text().await?;

    println!("Response: {}", body);
    
    // If you want to parse as JSON:
    // let json_response: serde_json::Value = serde_json::from_str(&body)?;
    // println!("Parsed JSON: {:?}", json_response);

    Ok(())
}
Примеры ответов
{
  "status": "success",
  "success": true,
  "message": "",
  "details": "",
  "results": [
    {
      "geometry": {
        "coordinates": [
          37.54140858819415,
          55.645325187960765
        ],
        "type": "Point"
      },
      "properties": {
        "id": 377436,
        "Walls": "панельные",
        "Entrance": 5,
        "lift": 5,
        "type": " ",
        "name": " ",
        "adres": "Москва, Введенского ул., 10, корп.1",
        "people": 539,
        "Household": 179,
        "Sastr": " ",
        "District": "Юго-Западный административный округ",
        "city": null,
        "year": 1968,
        "Floors": 9,
        "state": "действующий"
      },
      "id": "377436",
      "type": "Feature"
    },
    {
      "geometry": {
        "coordinates": [
          37.534530000315755,
          55.663900000316545
        ],
        "type": "Point"
      },
      "properties": {
        "id": 378038,
        "Walls": "панельные",
        "Entrance": 4,
        "lift": 4,
        "type": " ",
        "name": " ",
        "adres": "Москва, Воронцовские Пруды ул., 5",
        "people": 817,
        "Household": 271,
        "Sastr": " ",
        "District": "Юго-Западный административный округ",
        "city": null,
        "year": 1984,
        "Floors": 17,
        "state": "действующий"
      },
      "id": "378038",
      "type": "Feature"
    }
  ]
}
{
  "status": "success",
  "success": true,
  "message": "",
  "details": "",
  "results": [
    {
      "geometry": {
        "coordinates": [
          37.519138440510815,
          55.64613544901356
        ],
        "type": "Point"
      },
      "properties": {
        "id": 379005,
        "Walls": "монолитный железобетон",
        "Entrance": 5,
        "lift": 10,
        "type": " ",
        "name": " ",
        "adres": "Москва, Миклухо-Маклая ул., 33",
        "people": 1181,
        "Household": 392,
        "Sastr": " ",
        "District": "Юго-Западный административный округ",
        "city": null,
        "year": 2011,
        "Floors": 22,
        "state": "действующий"
      },
      "id": "379005",
      "type": "Feature"
    },
    {
      "geometry": {
        "coordinates": [
          37.545767231919,
          55.66676589569839
        ],
        "type": "Point"
      },
      "properties": {
        "id": 379220,
        "Walls": "панельные",
        "Entrance": 8,
        "lift": 8,
        "type": " ",
        "name": " ",
        "adres": "Москва, Наметкина ул., 1",
        "people": 1586,
        "Household": 526,
        "Sastr": " ",
        "District": "Юго-Западный административный округ",
        "city": null,
        "year": 1996,
        "Floors": 17,
        "state": "действующий"
      },
      "id": "379220",
      "type": "Feature"
    }
  ]
}