A team of Moroccan researchers has produced the first national high-resolution maps of phosphorus and potassium levels in Morocco's croplands using machine learning and thousands of soil samples. The freely available maps aim to improve fertilizer recommendations, support precision farming, and promote sustainable agriculture. A group of researchers from Morocco and Canada has created the first national high resolution maps of phosphorus and potassium levels in Morocco's farmland. These are two essential fertilizer elements that plants need to grow and thrive. Phosphorus (P) helps roots develop and boosts early growth, while potassium (K) supports photosynthesis, enzyme activity and stress resistance in plants. The researchers note that «P and K's availability and spatial distribution significantly influence fertilizer use efficiency and agricultural sustainability, especially in semi-arid countries like Morocco where nutrient limitations in soil often constrain crop yields by restricting plant growth and development». The new maps, the first of their kind in Morocco, will help farmers and policymakers determine exactly how much of these nutrients are present in the soil, enabling more accurate fertilizer recommendations and better agricultural strategies. High-resolution maps for better fertilizer recommendations In a paper titled «Baseline high resolution maps of soil nutrients in Morocco to support sustainable agriculture», published on August 8 by Nature, the authors detail how these national reference maps were developed. They used the Random Forest machine learning algorithm, combining 5,276 soil samples for phosphorus and 6,978 for potassium collected between 2010 and 2022 from across the country. To improve prediction accuracy, they also integrated 76 environmental factors, including climate, topography, vegetation and soil type. Unlike previous work that relied on traditional interpolation methods, this approach delivered detailed 250 meter resolution maps covering Morocco's croplands. The maps were tested using independent datasets and showed strong accuracy. An uncertainty assessment was also included to indicate the reliability of the predictions, the paper details. The maps are freely available in open access, allowing farmers, researchers and policymakers to use them to refine fertilizer use, support precision agriculture by tailoring practices to local conditions, and promote sustainable farming by avoiding both over- and under-fertilization. «This study represents a first attempt to demonstrate the advantages of integrating machine learning with environmental covariates for soil mapping in Morocco», the authors wrote. They added that it establishes a methodological framework that can be applied to future soil mapping projects as an alternative to traditional approaches.