Back to data catalog

Soil API

Global soil information based on SoilGrids-data

More info

Data sources

The API is exclusively fetching data from ISRIC (International Soil Reference and Information Centre) - World Soil Information's WebDAV functionality. The service uses SoilGrids data, which is licensed under the CC BY 4.0 license. The data are available at 250 meter resolution.

The nature of the available soil data can be separated into two categories: soil type and soil properties. Soil type data is categorical and represents the dominant soil type at the queried location. The 30 available soil types are: Acrisols, Albeluvisols, Alisols, Andosols, Arenosols, Calcisols, Cambisols, Chernozems, Cryosols, Durisols, Ferralsols, Fluvisols, Gleysols, Gypsisols, Histosols, Kastanozems, Leptosols, Lixisols, Luvisols, Nitisols, Phaeozems, Planosols, Plinthosols, Podzols, Regosols, Solonchaks, Solonetz, Stagnosols, Umbrisols, and Vertisols. More information about the soil types can be found here.

Soil property data is continuous and represents the value of a specific soil property at the queried location and depth. The available soil properties are: Bulk density (bdod), Cation exchange capacity (cec), Coarse fragments (cfvo), Clay (clay), Nitrogen (nitrogen), Organic carbon density (ocd), Organic carbon stocks (ocs), pH water (phh2o), Sand (sand), Silt (silt), and Soil organic carbon (soc). The available depths are: 0-5cm, 5-15cm, 15-30cm, 30-60cm, 60-100cm, 100-200cm, and 0-30cm (the ocs property is only available for the 0-30cm depth and vice versa.) The available values are: mean, 0.05 quantile, median, 0.95 quantile, and uncertainty.

For more information about the data, please visit the SoilGrids FAQ.

Processing

The data is retrieved from the ISRIC WebDAV service through various raster files and processed to be served through the API. For example, soil types are mapped from integer values to the corresponding soil type names, and the units of the soil properties are added to responses. Additionally, some aggregation is performed to produce a summary of the soil types, which, given a bounding box, provides a mapping of each soil type to its number of occurrences in the bounding box.

Examples

Example 1

Retrieving the most probable soil type at the queried location.

// Get the most probable soil type at the queried location
const response = await fetch(
	"https://api.openepi.io/soil/type?" +
		new URLSearchParams({
			lon: "9.58",
			lat: "60.1",
		})
)
const json = await response.json()

// Get the most probable soil type
const mostProbableSoilType = json.properties.most_probable_soil_type

console.log(`Most probable soil type: ${mostProbableSoilType}`)

Example 2

Retrieving the mean of the soil property at the queried location and depth.

// Get the mean value of the soil property at the queried location and depth
const response = await fetch(
	"https://api.openepi.io/soil/property?" +
		new URLSearchParams({
			lon: "9.58",
			lat: "60.1",
			depths: "0-5cm",
			properties: "bdod",
			values: "mean",
		})
)
const json = await response.json()

// Get the soil information for the bdod property
const bdod = json.properties.layers[0]

// Get the soil property unit and name
const bdodUnit = bdod.unit_measure.mapped_units
const bdodName = bdod.name

// Get the soil property mean value at depth 0-5cm
const bdodDepth = bdod.depths[0].label
const bdodValue = bdod.depths[0].values.mean

console.log(
	`Soil property: ${bdodName}, Depth: ${bdodDepth}, Value: ${bdodValue} ${bdodUnit}`
)

Example 3

Get a summary of the soil types in the queried bounding box.

// Get a summary of the soil types in the queried bounding box, represented
// by a mapping of each soil type to the number of occurrences in the bounding box
const response = await fetch(
	"https://api.openepi.io/soil/type/summary?" +
		new URLSearchParams({
			min_lon: "9.5",
			max_lon: "9.6",
			min_lat: "60.1",
			max_lat: "60.12",
		})
)
const json = await response.json()

// Get the summary of the soil types in the bounding box
const summaryList = json.properties.summaries

// Get the soil type and the number of occurrences
const soilType1 = summaryList[0].soil_type
const count1 = summaryList[0].count
const soilType2 = summaryList[1].soil_type
const count2 = summaryList[1].count
console.log(`Soil type: ${soilType1}, Count: ${count1}`)
console.log(`Soil type: ${soilType2}, Count: ${count2}`)