/glayer/objects
POST
Список объектов из слоя в формате GeoJSON
Скачивание объектов из слоя в формате GeoJSON
Если объектов много, то результат может скачиваться очень долго и в таком случае лучше скачивать пачками по очереди
Для этого существвют опциональные параметры limit и offset
Чтобы узнать сколько всего объектов в слое есть метод Количество объектов в слое
Например, если объектов 1000 и нужно скачать циклом по 100 штук, то нужно:
- Пропустить 0, скачать 100
- Пропустить 100, скачать 100
- Пропустить 200, скачать 100
и так далее пока не скачаются все объекты
limit и offset будут выглядеть вот так:
- offset 0, limit 100
- offset 100, limit 100
Также поддерживает фильтрацию с помощтю параметра where.
Headers
Body
Примеры запросов
curl -X POST \
-L 'https://api.geointellect.com/glayer/objects' \
-H 'ccode: request_user_007' \
-H 'key: dd83e51f-6d0a-4510-a885-6b54e5881961' \
--data-urlencode 'layerid=101' \
--data-urlencode 'aswgs=false' \
--data-urlencode 'limit=5' \
--data-urlencode 'offset=0' \
--data-urlencode 'where=int+people+%3c+10' \
-vusing 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");
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("aswgs", "false"));
collection.Add(new("limit", "5"));
collection.Add(new("offset", "0"));
collection.Add(new("where", "int people < 10"));
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"
headers = {
'ccode': 'request_user_007',
'key': 'dd83e51f-6d0a-4510-a885-6b54e5881961',
}
# URL-encoded form data
data = {
'layerid': '101',
'aswgs': 'false',
'limit': '5',
'offset': '0',
'where': 'int people < 10',
}
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',
'aswgs': 'false',
'limit': '5',
'offset': '0',
'where': 'int people < 10',
}),
};
fetch('https://api.geointellect.com/glayer/objects', 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"
fullUrl := baseUrl
formData := url.Values{
"layerid": {"101"},
"aswgs": {"false"},
"limit": {"5"},
"offset": {"0"},
"where": {"int people < 10"},
}
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".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("aswgs", "false");
form.insert("limit", "5");
form.insert("offset", "0");
form.insert("where", "int people < 10");
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": [
3370878.766800001,
8409454.126199998
],
"type": "Point"
},
"properties": {
"id": 267424,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "дачный дом",
"name": " ",
"adres": "Шувалово, садоводство 'Госрезерв', 4-я линия, 31",
"people": 2,
"Household": 1,
"Sastr": " ",
"District": "Приморский",
"city": "Санкт-Петербург",
"year": 0,
"Floors": 1,
"state": "действующий"
},
"id": "267424",
"type": "Feature"
},
{
"geometry": {
"coordinates": [
3370855.506499998,
8409764.655599996
],
"type": "Point"
},
"properties": {
"id": 267436,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "дачный дом",
"name": " ",
"adres": "Шувалово, садоводство 'Госрезерв', 5-я линия, 34",
"people": 2,
"Household": 1,
"Sastr": " ",
"District": "Приморский",
"city": "Санкт-Петербург",
"year": 0,
"Floors": 1,
"state": "действующий"
},
"id": "267436",
"type": "Feature"
},
{
"geometry": {
"coordinates": [
3371067.749899998,
8409157.586400002
],
"type": "Point"
},
"properties": {
"id": 267455,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "дачный дом",
"name": " ",
"adres": "Шувалово, садоводство 'Госрезерв', 5-я линия, 1",
"people": 2,
"Household": 1,
"Sastr": " ",
"District": "Приморский",
"city": "Санкт-Петербург",
"year": 0,
"Floors": 1,
"state": "действующий"
},
"id": "267455",
"type": "Feature"
},
{
"geometry": {
"coordinates": [
3370813.861499999,
8409748.766500004
],
"type": "Point"
},
"properties": {
"id": 267467,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "дачный дом",
"name": " ",
"adres": "Шувалово, садоводство 'Госрезерв', 5-я линия, 32",
"people": 2,
"Household": 1,
"Sastr": " ",
"District": "Приморский",
"city": "Санкт-Петербург",
"year": 0,
"Floors": 1,
"state": "действующий"
},
"id": "267467",
"type": "Feature"
},
{
"geometry": {
"coordinates": [
3370907.363400001,
8409329.471699998
],
"type": "Point"
},
"properties": {
"id": 267473,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "дачный дом",
"name": " ",
"adres": "Шувалово, садоводство 'Госрезерв', 4-я линия, 19",
"people": 2,
"Household": 1,
"Sastr": " ",
"District": "Приморский",
"city": "Санкт-Петербург",
"year": 0,
"Floors": 1,
"state": "действующий"
},
"id": "267473",
"type": "Feature"
}
]
}{
"status": "success",
"success": true,
"message": "",
"details": "",
"results": [
{
"geometry": {
"coordinates": [
7948990.4049,
6650357.3829
],
"type": "Point"
},
"properties": {
"id": 17891,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "Частный дом",
"name": null,
"adres": "Сарыарка проспект, 11/1",
"people": 3,
"Household": 1,
"Sastr": null,
"District": " ",
"city": "Нур-Султан",
"year": 0,
"Floors": 1,
"state": "действующий"
},
"id": "17891",
"type": "Feature"
},
{
"geometry": {
"coordinates": [
7948863.498399999,
6651003.906400003
],
"type": "Point"
},
"properties": {
"id": 17892,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "Частный дом",
"name": null,
"adres": "Челюскинцев, 77",
"people": 3,
"Household": 1,
"Sastr": null,
"District": " ",
"city": "Нур-Султан",
"year": 0,
"Floors": 2,
"state": "действующий"
},
"id": "17892",
"type": "Feature"
},
{
"geometry": {
"coordinates": [
7948879.601799998,
6650926.450199999
],
"type": "Point"
},
"properties": {
"id": 17893,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "Частный дом",
"name": null,
"adres": "Челюскинцев, 75",
"people": 3,
"Household": 1,
"Sastr": null,
"District": " ",
"city": "Нур-Султан",
"year": 0,
"Floors": 2,
"state": "действующий"
},
"id": "17893",
"type": "Feature"
},
{
"geometry": {
"coordinates": [
7948893.225200001,
6650860.363499999
],
"type": "Point"
},
"properties": {
"id": 17894,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "Частный дом",
"name": null,
"adres": "Челюскинцев, 73а",
"people": 3,
"Household": 1,
"Sastr": null,
"District": " ",
"city": "Нур-Султан",
"year": 0,
"Floors": 2,
"state": "действующий"
},
"id": "17894",
"type": "Feature"
},
{
"geometry": {
"coordinates": [
7948899.3343,
6650831.375100002
],
"type": "Point"
},
"properties": {
"id": 17895,
"Walls": null,
"Entrance": null,
"lift": null,
"type": "Частный дом",
"name": null,
"adres": "Челюскинцев, 71",
"people": 3,
"Household": 1,
"Sastr": null,
"District": " ",
"city": "Нур-Султан",
"year": 0,
"Floors": 1,
"state": "действующий"
},
"id": "17895",
"type": "Feature"
}
]
}Обратная связь
Оставьте заявку
Расскажите о задаче — подберём подходящее решение, покажем демо и рассчитаем стоимость. Ответим в течение рабочего дня.