Layers
There is an API to get the available images and another one to get the image in different formats/configurations.
To identify an image it is necessary to (field_id, layer_name, date, operation).
field_id
: field iddate
: date of the imagelayer_name
: layer nameoperation
: operation to be performed on the layer.
For example: For field 1500, take the Sentinel2 layer of date 2020-11-20T00:00:00Z and perform the ndvi1 operation on it.
APIs
Dates
GET /api/layers/dates/v3?field_id=field_id
Response:
An object with layer types. Each type has an array of possible operations, and an array of available dates. Each operation can be applied on each of the dates in the array.
{
'code': 0,
'layers': {
"layer_name1": {
"operations": [{...}, {...}],
"dates": [{...}, {...}],
},
"layer_name2": {
"operations": [{...}, {...}],
"dates": [{...}, {...}],
}
}
}
Each element of operations has:
operation
: is the operation code to identify the operation to the servers.name
: is a grouper to show to the user. It allows grouping operations of different types of layers that do the same thing. Ex: NDVI of Sentinel and Planet.
/dates/v3 object
Each object in the /dates/v3 API array dates has:
date
:string
, the date of the imagemin
:float
, the minimum average ndvi within the field perimetermax
:float
, the maximum average ndvi within the field perimetercloudy
:bool
, indicates if there are at least 5% cloudy pixels within the perimeter of the field. This is according to the classification given by Sentinel.
The dates elements are sorted by date, starting with the most recent.
Complete example of Response:
"layers": {
"ndvip1": {
"operations": [
{
"operation": "ndvip1",
"name": "NDVI"
}
],
"dates": [
{
"date": "2018-06-09T15:36:06Z",
"max": 65535,
"min": 36811.2
},
{
"date": "2018-06-01T15:36:02Z",
"max": 65535,
"min": 25619.5
},
{
"date": "2018-05-24T15:35:23Z",
"max": 65535,
"min": 40151.7
}
]
},
"Sentinel2": {
"operations": [
{
"operation": "ndvi1",
"name": "NDVI"
},
{
"operation": "gndvi1",
"name": "GNDVI"
},
{
"operation": "rgb1",
"name": "Visible"
},
{
"operation": "msavi2",
"name": "MSAVI2"
},
{
"operation": "ndre",
"name": "NDRE"
}
],
"dates": [
{
"date": "2020-06-10T00:00:00Z",
"max": 0.49,
"cloudy": true,
"min": -0.32
},
{
"date": "2020-06-05T00:00:00Z",
"max": 0.8,
"cloudy": false,
"min": -0.2
},
{
"date": "2020-05-31T00:00:00Z",
"max": 0.85,
"cloudy": false,
"min": 0.1
}
]
},
"siembra": {
"operations": [
{
"operation": "siembra",
"name": "siembra"
}
],
"dates": [
{
"date": "2019-12-13T15:15:38Z",
"max": 552257.969844542,
"metadata": {
"info": {
"cropSeason": "2019",
"cropName": "SOYBEANS"
}
},
"min": 358382.068724971
}
]
}
}
Geoserver
GET /api/geoserver/v2
URL parameters:
field_id
: field IDlayer_name
: layer image provider name.operation
: operation code.date
: date with YYYYY-MM-DDTHH:mm:ssZ formatformat
:- image/png: PNG as RGBA.
- image/tiff: GeoTiff.
- image/encoded: PNG as RGB. The data is sent in 16bits where the first 8bits are in the first layer of the PNG (R) and the second 8bits are in the second layer (G). The third layer (B) has all zeros.
This parameter is optional. If not included, the default is "image/png".
epsg
: Number of EPSGs to reproject the image.This parameter is optional. If not included, the default depends on the layer type.
bbox
:- Coordinates of the Bounding Box of the desired image to reproject.
The coordinates must be comma separated in the order: xmin,ymin,xmax,ymax.
They must also be in the EPSG of the final image. (It is recommended to use the EPSG parameter).
This parameter is optional. If it is not included, the final image corresponds to the BoundingBox of the field with a buffer of 2 pixels. If included, it is mandatory to include also width and height.
- Coordinates of the Bounding Box of the desired image to reproject.
The coordinates must be comma separated in the order: xmin,ymin,xmax,ymax.
They must also be in the EPSG of the final image. (It is recommended to use the EPSG parameter).
width
: Number of pixels of the width of the final image.This parameter is optional. If included, it is mandatory to include also bbox and height.
height
: Number of pixels of the height of the final image.This parameter is optional. If included, it is mandatory to include also bbox and width.
transparent
:true
: a mask is applied on the image to remove pixels outside the field.- in case of PNG, alpha pixels are set to 0 (transparent).
- in case of TIFF, pixels are set to NODATA.
false
: the mask is not applied.This parameter is optional. If not included, the default is false
Custom scale templates
GET /api/layers/scale_template
Returns the templates of the user's custom scales.
Full response example:
{
"scale_templates": [
{
"palette": "cb-RdYlGn",
"range_min": 0.17,
"type_distribution": "quantiles",
"template_name": "personalizada 1",
"cant_intervals": 5,
"scale_template_id": 1102,
"hierarchy": [
"Imágenes"
],
"colors_scale": {
"colors": [
[
215,
25,
28
],
[
253,
174,
97
],
[
255,
255,
191
],
[
166,
217,
106
],
[
26,
150,
65
]
],
"scale": [
0.41747474747474717,
0.4669696969696966,
0.502323232323232,
0.5588888888888889
]
},
"layer_name": "Sentinel2",
"range_max": 0.87,
"operation": "ndvi1"
},
{
"palette": "cb-Spectral",
"range_min": -652.07,
"type_distribution": "equidistant",
"template_name": "ls_personalizada_1",
"cant_intervals": 3,
"scale_template_id": 1139,
"hierarchy": [
"Actividades",
"Prescripciones"
],
"colors_scale": {
"colors": [
[
153,
213,
148
],
[
255,
255,
191
],
[
252,
141,
89
]
],
"scale": [
-434.3799999999992,
-210.09333333333186
]
},
"layer_name": "Urea",
"range_max": 1,
"operation": "Urea"
},
],
"code": "RETRIEVED_SCALE_TEMPLETES"
}
Available images
Avaliable images can be consuted through Dates API
Sentinel2
If no reprojection is requested, the resolution of these images is 10x10 metres in the WGS84 / UTM projection.
Each image has 2 pixels of margin around the perimeter of the field.
The operations available on this layer provider are:
ndvi1
: NDVIgndvi1
: GNDVIrgb1
: RGBmsavi2
: MSAVI2ndre
: NDRE
tiff images.
For the operations ndvi1, gndvi1, msavi2 and ndre a single band GeoTiff is delivered. Each pixel is the index value indicated by the operation in float32. The NODATA value of these is nan.
In the case of rgb1, a 3-band GeoTiff is delivered where each pixel is a Byte (uint8). Their NODATA value is 0.
Creating New Layers
This is a two step process:
- In the first one, you upload a file for our API to analize and return information about it.
- In the second step, with this info, the user indicates column, units and more details; and calls our second endpoint to process the file and create the layer.
Upload files
POST /files
Body (Form):
file: zip with files.
-
Possible formats: csv, xlsx, txt, shp(with asociated required files)
-
CSV Example:
lat;lon;variable_1;var_2
40.35715828;-89.92172667;35010;25
40.35715828;-89.92172375;35010;15
40.35715825;-89.92172082;35005;10 -
XLSX / XLS Example:
lat lon variable_1 var_2 40,35715828 -89,92172667 35010 25 40,35715828 -89,92172375 35010 15 40,35715825 -89,92172082 35005 10
-
-
Valid geometries: MultiPolygon
-
Possible responses
- 400 -
{ "error_code": "ERROR_ARCHIVO" }
Your file is not right
- 200 -
{"data":
{"not_found": True,
"lote": `WKT DEL ARCHIVO`}
}this means that your files do not match any of the users' fields
-
200 -
{"data": {
"redis_id": redis_id,
"lote_id": field_id,
"columns": [list of columns],
"stats": ,
"histograms": ,
}}
Process files
POST /raster
Body (json):
redis_id: HASH from previous endpoint
date: layer date, format: "YYYY-MM-DD HH:MM:SS"
data: settings object
lote_id: field id
The settings object can be made this way:
- for each key that is sent a layer will be created
- each key is the name of the column on which you want to build the layer
- each value is an object that has the settings for the new layer:
id_layer
: id fortipo_capa
from the layer you want to createmean
: (float o null) nueva mean valuemin
: (float o null) minimum value (outliers)max
: (float o null) minimum value (outliers)meta
:numerador_media
: numerator unitdenominador_media
: denominator unit
Generate raster layer from interpolation of points by "kriging"
On many occasions we have data obtained at different points of a field. In that case, it is easier to view the data in a raster layer format rather than in isolated points.
Fortunately we can interpolate the points through kriging to generate a raster layer from these.
To achieve this, a parameter "interpolation_type" with the value "kriging" shall be sent in the settings of the desired layer, which is found within the settings object.
Example of json sent in the /raster endpoint body:
{
redis_id: "ABCD1234",
lote_id: "123456",
date: "2022-12-13 00:00:00",
data: {
capa1: {
id_layer: 419,
interpolation_type: "kriging",
mean: 12.34,
min: 6,
max: 34.56,
meta: {
numerador_media: "kg",
denominador_media: "ha",
}
}
}
}
Layer types
id | nombre |
---|---|
1 | ndvi1 |
2 | ndvip1 |
3 | gndvi1 |
4 | gndvip1 |
5 | rinde |
6 | rgb1 |
7 | rgbp1 |
8 | altimetria |
9 | siembra |
10 | herbicida |
11 | fungicida |
12 | insecticida |
13 | fertilizante |
14 | enmienda |
15 | profundidad_suelo |
17 | Densidad_20 |
22 | margen_bruto |
24 | ndvi0.8 |
25 | vigor planta |
26 | tcari/osavi |
27 | NDRE |
29 | RGB0.8 |
31 | Sentinel2 |
32 | Planet |
34 | aplicación |
35 | humedad |
36 | Electroconductividad_70 |
37 | Electroconductividad_150 |
39 | siembra_vel_avance |
40 | siembra_var |
41 | siembra_fecha |
42 | rinde_hum |
43 | rinde_vel_avance |
44 | rinde_fecha |
45 | MO_20 |
46 | MO_30 |
47 | MO_40 |
48 | MO_50 |
49 | MO_60 |
50 | MO_70 |
51 | MO_80 |
52 | MO_90 |
53 | MO_100 |
54 | MO_110 |
55 | MO_120 |
56 | MO_130 |
57 | MO_140 |
58 | MO_150 |
59 | N_20 |
60 | N_30 |
61 | N_40 |
62 | N_50 |
63 | N_60 |
64 | N_70 |
65 | N_80 |
66 | N_90 |
67 | N_100 |
68 | N_110 |
69 | N_120 |
70 | N_130 |
71 | N_140 |
72 | N_150 |
73 | P_20 |
74 | P_30 |
75 | P_40 |
76 | P_50 |
77 | P_60 |
78 | P_70 |
79 | P_80 |
80 | P_90 |
81 | P_100 |
82 | P_110 |
83 | P_120 |
84 | P_130 |
85 | P_140 |
86 | P_150 |
87 | K_20 |
88 | K_30 |
89 | K_40 |
90 | K_50 |
91 | K_60 |
92 | K_70 |
93 | K_80 |
94 | K_90 |
95 | K_100 |
96 | K_110 |
97 | K_120 |
98 | K_130 |
99 | K_140 |
100 | K_150 |
101 | S_20 |
102 | S_30 |
103 | S_40 |
104 | S_50 |
105 | S_60 |
106 | S_70 |
107 | S_80 |
108 | S_90 |
109 | S_100 |
110 | S_110 |
111 | S_120 |
112 | S_130 |
113 | S_140 |
114 | S_150 |
115 | PH_20 |
116 | PH_30 |
117 | PH_40 |
118 | PH_50 |
119 | PH_60 |
120 | PH_70 |
121 | PH_80 |
122 | PH_90 |
123 | PH_100 |
124 | PH_110 |
125 | PH_120 |
126 | PH_130 |
127 | PH_140 |
128 | PH_150 |
129 | Ca_20 |
130 | Ca_30 |
131 | Ca_40 |
132 | Ca_50 |
133 | Ca_60 |
134 | Ca_70 |
135 | Ca_80 |
136 | Ca_90 |
137 | Ca_100 |
138 | Ca_110 |
139 | Ca_120 |
140 | Ca_130 |
141 | Ca_140 |
142 | Ca_150 |
143 | Mg_20 |
144 | Mg_30 |
145 | Mg_40 |
146 | Mg_50 |
147 | Mg_60 |
148 | Mg_70 |
149 | Mg_80 |
150 | Mg_90 |
151 | Mg_100 |
152 | Mg_110 |
153 | Mg_120 |
154 | Mg_130 |
155 | Mg_140 |
156 | Mg_150 |
157 | Na_20 |
158 | Na_30 |
159 | Na_40 |
160 | Na_50 |
161 | Na_60 |
162 | Na_70 |
163 | Na_80 |
164 | Na_90 |
165 | Na_100 |
166 | Na_110 |
167 | Na_120 |
168 | Na_130 |
169 | Na_140 |
170 | Na_150 |
171 | Electroconductividad_30 |
172 | Electroconductividad_40 |
173 | Electroconductividad_60 |
174 | Electroconductividad_90 |
175 | Electroconductividad_100 |
176 | Electroconductividad_120 |
177 | Electroconductividad_130 |
178 | Electroconductividad_140 |
179 | Arena_20 |
180 | Arena_30 |
181 | Arena_40 |
182 | Arena_50 |
183 | Arena_60 |
184 | Arena_70 |
185 | Arena_80 |
186 | Arena_90 |
187 | Arena_100 |
188 | Arena_110 |
189 | Arena_120 |
190 | Arena_130 |
191 | Arena_140 |
192 | Arena_150 |
193 | Arcilla_20 |
194 | Arcilla_30 |
195 | Arcilla_40 |
196 | Arcilla_50 |
197 | Arcilla_60 |
198 | Arcilla_70 |
199 | Arcilla_80 |
200 | Arcilla_90 |
201 | Arcilla_100 |
202 | Arcilla_110 |
203 | Arcilla_120 |
204 | Arcilla_130 |
205 | Arcilla_140 |
206 | Arcilla_150 |
207 | Limo_20 |
208 | Limo_30 |
209 | Limo_40 |
210 | Limo_50 |
211 | Limo_60 |
212 | Limo_70 |
213 | Limo_80 |
214 | Limo_90 |
215 | Limo_100 |
216 | Limo_110 |
217 | Limo_120 |
218 | Limo_130 |
219 | Limo_140 |
220 | Limo_150 |
221 | Densidad_30 |
222 | Densidad_40 |
223 | Densidad_50 |
224 | Densidad_60 |
225 | Densidad_70 |
226 | Densidad_80 |
227 | Densidad_90 |
228 | Densidad_100 |
229 | Densidad_110 |
230 | Densidad_120 |
231 | Densidad_130 |
232 | Densidad_140 |
233 | Densidad_150 |
234 | aplicación_fecha |
235 | aplicación_hum |
236 | aplicación_presion |
237 | aplicación_temp |
238 | aplicación_vel_avance |
239 | costo |
240 | ingreso |
390 | Electroconductividad_20 |
391 | Electroconductividad_50 |
392 | Electroconductividad_80 |
393 | Electroconductividad_110 |