Skip to content

Fields API

This service provides the API for receiving field geometries by point, bbox or arbitrary geometry.

Limitations

The maximum geometry area cannot exceed 400.000.000 square meters (40.000 ha).

The supported EPSG is 4326 only.

Getting field data

GET /v1/fields/{year}/

Request parameters

Name Type Description
year Integer Requested year >= 2016
bbox String Bounding box in the format min_lon,min_lat,max_lon,max_lat (optional)
geometry_wkt WKT Area of interest encoded in WKT format (optional)
crop_name String Crop name
crop_season String Unique identifier of season (season1 / season2)
include_all Boolean Return all available predictions, including in-season (optional, default=false)
not_found_if_empty Boolean Returns a 404 error instead of an empty FeatureCollection if no data is found (optional, default=false)

Feature properties

Name Type Description
id Integer Unique identifier of field
area Float Area in square meters
crop_name String Crop name
crop_eppo_code String Abbreviation in corresponding with EPPO Global Database
crop_season String Unique identifier of season (season1 / season2)
crop_season_start String String in format ISO-8601 that represented start of season date
crop_season_end String String in format ISO-8601 that represented end of season date
is_actual_season Boolean Shows whether the season is actual or historical
crop_confidence Object Confidence level of the detected crops (Example {"soybeans": 0.8286, "not_field": 0.1714})
crop_predicted_for String String in format ISO-8601 that represented date for which prediction was made
country_alpha_3 String Country code ISO 3166-1 alpha-3

Possible errors

Invalid input parameters

Token wasn't provided

Not allowed. Quota exceeded or other restrictions have been violated

No available data for this area or No predicted data for this area

Server error. Please contact support

Examples

Get fields by geometry (in WKT format)

Click by any field within bounding box:

export ONESOIL_API_TOKEN=<YOUR TOKEN>
export ONESOIL_API_HOST=https://api-b2b.prod-be.onesoil.ai

curl --request GET \
  --url "${ONESOIL_API_HOST}/v1/fields/2023?geometry_wkt=POINT(4.937641713030359+50.628494973329396)" \
  --header "authorization: Bearer ${ONESOIL_API_TOKEN}"
{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "MultiPolygon",
                "coordinates": [
                    [
                        [
                            [4.935040985, 50.631910051],
                            [4.9351823, 50.631907703],
                            [4.935320847, 50.631837946],
                            [4.9355924, 50.631563611],
                            [4.935720792, 50.631246685],
                            [4.936030437, 50.631039173],
                            [4.936289056, 50.630450259],
                            [4.936358788, 50.630426615],
                            [4.936389499, 50.630313678],
                            [4.93659223, 50.630085456],
                            [4.93676425, 50.62997017],
                            [4.936795883, 50.629879703],
                            [4.937035785, 50.629695833],
                            [4.937099973, 50.629537369],
                            [4.937203183, 50.629468197],
                            [4.937364113, 50.629083272],
                            [4.937705369, 50.628785288],
                            [4.937769554, 50.628626824],
                            [4.937872761, 50.628557651],
                            [4.937967651, 50.62828625],
                            [4.938241018, 50.62805685],
                            [4.938271723, 50.627943913],
                            [4.938408405, 50.627829212],
                            [4.93856932, 50.627444286],
                            [4.938772953, 50.62723853],
                            [4.938697681, 50.627127357],
                            [4.938517358, 50.627040417],
                            [4.937840637, 50.626916767],
                            [4.937803464, 50.626872415],
                            [4.937554341, 50.626831589],
                            [4.937230875, 50.626702058],
                            [4.936838607, 50.626618641],
                            [4.936521607, 50.626646397],
                            [4.936350522, 50.626784152],
                            [4.936319813, 50.626897088],
                            [4.936216607, 50.62696626],
                            [4.936185898, 50.627079196],
                            [4.936049213, 50.627193894],
                            [4.935750667, 50.627671045],
                            [4.935680939, 50.627694689],
                            [4.935616748, 50.627853152],
                            [4.935547019, 50.627876796],
                            [4.935482827, 50.628035259],
                            [4.935413098, 50.628058903],
                            [4.935214983, 50.628399472],
                            [4.935111773, 50.628468642],
                            [4.934950826, 50.628853564],
                            [4.934881096, 50.628877208],
                            [4.934415117, 50.629581988],
                            [4.934211455, 50.629787737],
                            [4.934147257, 50.629946199],
                            [4.93380597, 50.630244173],
                            [4.933607835, 50.63058474],
                            [4.933266541, 50.630882712],
                            [4.933133525, 50.631087286],
                            [4.933138134, 50.631199635],
                            [4.933284057, 50.631309639],
                            [4.933927346, 50.631478842],
                            [4.934395841, 50.631695915],
                            [4.934644987, 50.631736747],
                            [4.935040985, 50.631910051],
                        ]
                    ]
                ],
            },
            "properties": {
                "area": 100893.63821834345,
                "country_alpha_3": "BEL",
                "id": 194515048,
                "crop_name": "wheat",
                "crop_eppo_code": "TRZAX",
                "crop_season": "season1",
                "crop_season_start": "2023-03-01T00:00:00",
                "crop_season_end": "2023-09-30T00:00:00",
                "is_actual_season": false,
                "crop_confidence": null,
                "crop_predicted_for": "2023-09-30T00:00:00",
            },
            "id": 194515048,
        }
    ],
    "crs": {"properties": {"name": "urn:ogc:def:crs:EPSG::4326"}},
}
const ONESOIL_API_TOKEN = "<YOUR TOKEN>";
const ONESOIL_API_HOST = "https://api-b2b.prod-be.onesoil.ai";

let wellknown = require('wellknown');

let query = new URLSearchParams({
  geometry_wkt: wellknown.stringify({
    'type': 'Point',
    'coordinates': [point.lng, point.lat]
  }),
});

let response = await fetch(
   `${ONESOIL_API_HOST}/v1/fields/${ONESOIL_YEAR}?${query.toString()}`,
    {
        headers: {
            "Accept": "application/json",
            "Authorization": `Bearer ${ONESOIL_API_TOKEN}`
        }
    }
);
console.log(await response.json());

Get fields by bbox

export ONESOIL_API_TOKEN=<YOUR TOKEN>
export ONESOIL_API_HOST="https://api-b2b.prod-be.onesoil.ai"

curl --request GET \
  --url "${ONESOIL_API_HOST}/v1/fields/2023?bbox=4.98%2C50.63%2C5.01%2C50.65" \
  --header "authorization: Bearer ${ONESOIL_API_TOKEN}"
const ONESOIL_API_TOKEN = "<YOUR TOKEN>";
const ONESOIL_API_HOST = "https://api-b2b.prod-be.onesoil.ai";

let bbox = [4.98, 50.63, 5.01, 50.65];
let query = new URLSearchParams({
    bbox: bbox.join(","),
});

let response = await fetch(
    `${ONESOIL_API_HOST}/v1/fields/${ONESOIL_YEAR}?${query.toString()}`,
    {
        headers: {
            "Accept": "application/json",
            "Authorization": `Bearer ${ONESOIL_API_TOKEN}`
        }
    }
);

console.log(await response.json());