World Agriculture Indicators

This is a collection of country level agricultural indicators from the Food and Agriculture Organization of the United Nations (FAO).

Data is from 2019 to capture chronologically unified information unaffected by the disruptions of the COVID-19 pandemic.

This data is available in CSV and GeoJSON formats.

Polygons

Natural Earth. 2022. Admin 0 - Countries, version 5.0.0. Accessed 5 February 2022. https://www.naturalearthdata.com/downloads/10m-cultural-vectors/.

Identifiers

Name

Commonly used country names from the Natural Earth polygon data above with abbreviations expanded

Official Name

The full official UN names of the countries from the Natural Earth data.

ISO3

A set of standardized three-letter country codes

https://www.iso.org/iso-3166-country-codes.html.

UN Country Code

Three digit country codes used by UN agencies like FAO.

Area

Land Area k ha

Land area in thousands of hectacres

Agricultural k ha

Agricultural land area in thousands of hectacres

Cropland k ha

Cropland area in thousands of hectacres

Arable k ha

Potential cropland area in thousands of hectacres

Forests k ha

Forested area in thousands of hectacres

Pasture k ha

Permanent meadows and pastures in thousands of hectacres

Inputs

Fertilizer N Tonnes

Metric tons of nitrogen in fertilizer used annually

Fertilizer P Tonnes

Metric tons of phosphorus in fertilizer used annually

Fertilizer K Tonnes

Metric tons of potassium in fertilizer used annually

Economics

GDP MM Dollars

Annual GDP in millions of current US dollars

Agricultural MM Dollars

Total annual revenue from agricultural production in millions of current US dollars

Crop Production Dollars

Total annual revenue from crop production in millions of current US dollars

Food Production Dollars

Total annual revenue from food production millions of current US dollars

Cereals Production Dollars

Total annual revenue from cereal grain production in millions of current US dollars

Livestock Production Dollars

Total annual revenue from livestock production in millions of current US dollars

Fruit Production Dollars

Total annual revenue from fruit production in millions of current US dollars

Vegetable Production Dollars

Total annual revenue from vegetable production in millions of current US dollars

Production Volume

Cereals Production Tonnes

Total annual cereal grain production in metric tons.

Meat Production Tonnes

Total annual meat production in metric tons.

Fruit Production Tonnes

Total annual fruit production in metric tons.

Vegetable Production Tonnes

Total annual vegetable production in metric tons.

Demographics

Total Population k

Total population in thousands of persons.

Rural Population k

Total rural population in thousands of persons.

Urban Population k

Total urban population in thousands of persons.

Protein g Capita Day

Three year average of estimated per capita grams of plant/animal protein consumed per day.

Animal Protein g Capita Day

Three year average of estimated per capita grams of animal protein consumed per day.

Appendix: Python Code

The following is the Python code to create the data set using the FAO's API. While the faostat package can be used to hide the complexity of API usage, this code is provided here as an example of API usage since, as of this writing, there are limited practical examples on the web for using the API to access FAO data.

The FAO data is organized into domains, elements, items, and years. Those codes are displayed when you display data search results on the FAOSTAT web site.

For an example of cereal production in tonnes:

The API URL is:

https://fenixservices.fao.org/faostat/api/v1/en/data/QCL?element=2510&item=1717&year=2019
&area_cs=ISO3&show_code=1&show_unit=1&show_flags=0&null_values=0
&limit=-1&output_type=objects

The following code was used to download the indicators for this data set and join them with the Natural Earth polygons for mapping and spatial analysis.

import requests
import pandas
import geopandas
import matplotlib.pyplot as plt

countries = geopandas.read_file("https://michaelminn.net/tutorials/data/2023-natural-earth-countries.geojson")

countries = countries.rename(columns={"NAME":"Name", "FORMAL_EN":"Official Name", "ISO_A3":"ISO3"})

# Each value has a domain code, element code, item code, and year code

indicators = { 
"Land Area k ha":			["RL", "5110", "6601", "year=2019"],
"Agricultural k ha":			["RL", "5110", "6610", "year=2019"],	
"Cropland k ha":			["RL", "5110", "6620", "year=2019"],
"Arable k ha":				["RL", "5110", "6621", "year=2019"],
"Forests k ha":				["RL", "5110", "6646", "year=2019"],
"Pasture k ha":				["RL", "5110", "6655", "year=2019"],
"Fertilizer N Tonnes":			["RFN", "2515", "3102", "year=2019"],
"Fertilizer P Tonnes":			["RFN", "2515", "3103", "year=2019"],
"Fertilizer K Tonnes":			["RFN", "2515", "3104", "year=2019"],
"GDP MM Dollars":			["MK", "6110", "22008", "year=2019"],
"Agricultural MM Dollars":		["QV", "57", "2051", "year=2019"],
"Crop Production MM Dollars":		["QV", "57", "2041", "year=2019"],
"Food Production MM Dollars":		["QV", "57", "2054", "year=2019"],
"Cereals Production MM Dollars":	["QV", "57", "1717", "year=2019"],
"Livestock Production MM Dollars":	["QV", "57", "2044", "year=2019"],
"Fruit Production MM Dollars":		["QV", "57", "1738", "year=2019"],
"Vegetable Production MM Dollars":	["QV", "57", "1735", "year=2019"],
"Cereals Production Tonnes":		["QCL", "2510", "1717", "year=2019"],
"Meat Production Tonnes":		["QCL", "2510", "1765", "year=2019"],
"Fruit Production Tonnes":		["QCL", "2510", "1738", "year=2019"],
"Vegetable Production Tonnes":		["QCL", "2510", "1735", "year=2019"],
"Total Population k":			["OA", "511", "3010", "year=2019" ],
"Rural Population k":			["OA", "551", "3010", "year=2019" ],
"Urban Population k":			["OA", "561", "3010", "year=2019"],
"Protein g Capita Day":			["FS", "6120", "21013", "year3=20183" ],
"Animal Protein g Capita Day":		["FS", "6120", "21014", "year3=20183" ] }

endpoint_url = 'https://fenixservices.fao.org/faostat/api/v1/en/data/'

for varname, params in indicators.items():
	print(varname, params)
	url = endpoint_url + params[0] + '?element=' + params[1] + \
		'&item=' + params[2] + "&" + params[3] + '&area_cs=ISO3' + \
		'&show_code=1&show_unit=1&show_flags=0&null_values=0' + \
		'&limit=-1&output_type=objects'
	response = requests.get(url)
	data = response.json()['data']
	data = pandas.DataFrame(data[1:], columns=data[0])
	data = data.rename(columns={"Area Code (ISO3)":"ISO3", "Value":varname})
	data = data[["ISO3", varname]]
	data[varname] = pandas.to_numeric(data[varname])
	print(data.info())
	countries = countries.merge(data, how="left")
	print(countries.info())

countries.to_file("2019-world-agriculture-indicators.geojson")

csv = countries.drop(["geometry"], axis=1)

csv.to_csv("2019-world-agriculture-indicators.csv", index=False)

axis = countries.plot("Protein g Capita Day", scheme="naturalbreaks", cmap="coolwarm_r", 
	legend=True, legend_kwds={"bbox_to_anchor":(0.3, 0.3)})

axis.set_axis_off()

plt.show()