Geoserver [deprecated]
This document describes Onesoil Geoserver that provides access to our predicted field boundaries.
GeoServer is an open source server for sharing geospatial data. It's provide several services such as WMS, WFS, WMTS or Geowebcache.
Currently we provide data-layers since 2016 to 2021 years
Glossary
- season - predefined time-period for which prediction was made and which typically represents agricultural cycle
- crop - most likely culture detected by our algorithm
Basic Authentication
The Geoserver supports Basic Authentication as defined in RFC2617.
For demo purpose available following credentials:
- Username: demo
- Password: demo
Layers
Known limitations
For all layers minimal allowed zoom is 11
By default we provide supports of following formats:
-
Vector data
- Geojson format (content-type: application/json)
- Mapbox Vector Tile format (content-type: application/vnd.mapbox-vector-tile)
-
Raster data:
- 8 bit PNG format (content-type: image/png8)
Available layers:
- fields_2021 - Field boundaries for 2021 year
- fields_2020 - Field boundaries for 2020 year
- fields_2019 - Field boundaries for 2019 year
- fields_2018 - Field boundaries for 2018 year
- fields_2017 - Field boundaries for 2017 year
- fields_2016 - Field boundaries for 2016 year
Attributes
Each layer may consists following attributes. Set of available attributes depends from you plan.
| Name | Description | Example |
|---|---|---|
| fid | Unique identifier of field | 15173193 |
| idx | Unique identifier of field within region | 786845 |
| crop_name | Name of predicted culture | maize |
| crop_eppo_code | Culture code from EPPO Global Database | ZEAMX |
| crop_year | Year | 2021 |
| crop_season | Name os season | season1 |
| crop_season_start | Datetime in ISO 8601 starting of season | 2021-03-01 03:00:00 |
| crop_season_end | Datetime in ISO 8601 ending of season | 2021-10-01 03:00:00 |
| country_name | Name of country in latin | belgium |
| country_code | Country code in ISO_3166-1 | BEL |
| country_region_name | Name of region in latin | wallonia |
| country_region_code | Region code in ISO_3166-1 | BE-WAL |
| country_region_nuts3 | Region code in NUTS level3 | BE352 |
| country_subregion_code | Custom codes for some regions | |
| area_ha | Area of field in hectares | 9.407 |
| tile_id | Coordinates in MGRS | 31UFS |
| esri_zstat_majority | for service purposes | 5 |
| version | Version of algorithm that was used for prediction | 2 |
Examples
WFS
Example of working with WFS, for more details please see WFS reference
const layer = "demo"
const workspace = "demo"
const user = "demo"
const password = "demo"
const empty_geojson = {"type": "FeatureCollection", "features": []}
mapboxgl.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
const map_wfs = new mapboxgl.Map({
container: 'map_wfs',
style: 'mapbox://styles/mapbox/satellite-streets-v11',
zoom: 12,
center: [4.9, 50.6],
});
map_wfs.on('load', () => {
map_wfs.addSource(
'boundaries', {
'type': 'geojson',
'data': empty_geojson
}
);
map_wfs.addLayer({
'id': 'boundaries-line',
'type': 'line',
'source': 'boundaries',
'paint': {
'line-color': '#fff',
'line-width': 3
},
});
map_wfs.on('click', (e) => {
$.ajax({
async: true,
type: "GET",
url: "https://fields-boundaries-api.prod-dp.onesoil.ai" +
"/geoserver/" + workspace + "/wfs" +
"?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature" +
"&TYPENAME=" + workspace + ":" + layer +
"&SRS=EPSG:4326&OUTPUTFORMAT=application/json" +
"&CQL_FILTER=CONTAINS(geom,POINT(" +
e.lngLat.lng + "%20" + e.lngLat.lat + "))",
headers: {
"Authorization": "Basic " + btoa(user + ":" + password),
},
success: function (result){
if(result.numberReturned == 0){
map_wfs.getSource('boundaries').setData(empty_geojson)
alert("No data")
}else{
map_wfs.getSource('boundaries').setData(result)
}
}
});
})
})
Request:
url=""
url+="https://fields-boundaries-api.prod-dp.onesoil.ai/geoserver/demo/wfs"
url+="?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=demo:demo"
url+="&SRS=EPSG:4326&OUTPUTFORMAT=application/json"
url+="&CQL_FILTER=CONTAINS(geom,POINT(4.882414513279031%2050.60139179110135))"
curl -u "demo:demo" $url
Output:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "demo.15328057",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[4.8836858615, 50.5986104803],
[4.8801232308, 50.5992796473],
[4.880042796, 50.5993888745],
[4.8802809324, 50.5996908278],
[4.8805401506, 50.5998125591],
[4.8805437336, 50.5999024418],
[4.8798143833, 50.6000401338],
[4.8795687743, 50.6002599554],
[4.8806640066, 50.6015014417],
[4.8814206223, 50.6020468523],
[4.8828168763, 50.6023300852],
[4.8856493977, 50.6024821264],
[4.8857312618, 50.6024088484],
[4.8855083886, 50.6017828728],
[4.8845169056, 50.5996043703],
[4.8843091413, 50.5993558984],
[4.8841116746, 50.5986575564],
[4.8840530329, 50.5986045408],
[4.8836858615, 50.5986104803]
]
]
]
},
"geometry_name": "geom",
"properties": {
"fid": 15328057,
"idx": 796060,
"crop_name": "other",
"crop_eppo_code": "OTHER",
"crop_year": 2021,
"crop_season": "season1",
"crop_season_start": "2021-03-01T00:00:00Z",
"crop_season_end": "2021-10-01T00:00:00Z",
"country_name": "belgium",
"country_code": "BEL",
"country_region_name": "wallonia",
"country_region_code": "BE-WAL",
"country_region_nuts3": "BE352",
"country_subregion_code": null,
"area_ha": 12.3922,
"tile_id": "31UFS",
"esri_zstat_majority": 5
},
"bbox": [
4.8795687743, 50.5986045408, 4.8857312618, 50.6024821264
]
}
],
"totalFeatures": "unknown",
"numberReturned": 1,
"timeStamp": "2022-04-08T18:11:26.149Z",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:EPSG::4326"
}
},
"bbox": [
4.8795687743, 50.5986045408, 4.8857312618, 50.6024821264
]
}
from owslib.wfs import WebFeatureService
wfs = WebFeatureService(
username="demo",
password="demo",
url='https://fields-boundaries-api.prod-dp.onesoil.ai/geoserver/demo/wfs',
version='1.1.0'
)
# Download GML using typename, bbox and srsname.
wfs.getfeature(
typename='demo:demo',
bbox=(4.779653549194336, 50.56655704140765, 4.796819686889648, 50.57756840272205),
srsname='urn:x-ogc:def:crs:EPSG:4326'
)
WMS
Example working with WMS service with GeoWebCache, for more details see WMS reference
const layer = "demo"
const workspace = "demo"
const user = "demo"
const password = "demo"
mapboxgl.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
const map_wms = new mapboxgl.Map({
container: 'map_wms',
style: 'mapbox://styles/mapbox/satellite-streets-v11',
center: [4.9, 50.6],
zoom: 12,
transformRequest: (url, resourceType)=> {
if(url.startsWith('https://fields-boundaries-api')) {
return {
url: url,
headers: {
'Authorization': "Basic " + btoa(user + ":" + password),
},
}
}
}
});
map_wms.on('load', () => {
map_wms.addSource(
'wms-source',
{
'type': 'raster',
'tiles': [
'https://fields-boundaries-api.prod-dp.onesoil.ai' +
'/geoserver/' + workspace + '/gwc/service/wms' +
'?bbox={bbox-epsg-3857}' +
'&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857' +
'&format=image/png8' +
'&transparent=true&width=256&height=256' +
'&layers=' + layer
],
'tileSize': 256,
'minzoom': 11
}
);
map_wms.addLayer(
{
'id': 'wms-layer',
'type': 'raster',
'source': 'wms-source',
'paint': {}
}
);
});
curl -u "demo:demo" "https://fields-boundaries-api.prod-dp.onesoil.ai/geoserver/onesoil/gwc/service/wms?bbox=552792.5885583945,6550347.575926464,557684.5583686456,6555239.545736715&format=image/png8&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&transparent=true&width=256&height=256&layers=demo" > image.png
WMTS
Example of using vector tile source in Mapbox Vector Tile format.
const layer = "demo"
const workspace = "demo"
const user = "demo"
const password = "demo"
mapboxgl.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
const map_wmts = new mapboxgl.Map({
container: 'map_wmts',
style: 'mapbox://styles/mapbox/satellite-streets-v11',
center: [4.9, 50.6],
zoom: 12,
transformRequest: (url, resourceType)=> {
if(url.startsWith('https://fields-boundaries-api')) {
return {
url: url,
headers: {
'Authorization': "Basic " + btoa(user + ":" + password),
},
}
}
}
});
map_wmts.on('load', () => {
map_wmts.addSource(
'boundaries',
{
'type': 'vector',
'tiles': [
'https://fields-boundaries-api.prod-dp.onesoil.ai' +
"/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS" +
"&VERSION=1.0.0&LAYER=" + workspace + ":" + layer + "&TILEMATRIX=EPSG:900913:{z}" +
"&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile" +
"&TILECOL={x}&TILEROW={y}"
],
'minzoom': 11,
'maxzoom': 18
}
);
map_wmts.addLayer({
'id': 'boundaries-outline',
'type': 'line',
'source': 'boundaries',
'source-layer': layer,
'paint': {
'line-color': '#fff',
'line-width': 1
}
});
});
Info
More complex example you can find here