R interface to the Harmonized World Soil Database


See either the ingestr R package Or the netcdf version of the database

This package was created long ago, when the database was originally released in MS Access format that was then converted to the sqlite database found in inst/extdata

This is a wrapper package containing the HWSD and helper functions. This package is based on:


Based on "Technical note: Processing the Harmonized World Soil Database (Version 1.2) in R" By D G Rossiter Dec 7, 2012 (available online, with copy in the rwhsd package man folder).


2008-2009 COPYRIGHT FAO, IIASA, ISRIC, ISSCAS, JRC All rights reserved. No part of this Harmonized World Soil Database may be reproduced, stored in a retrieval system or transmitted by any means for resale or other commercial purposes without written permission of the copyright holders. Reproduction and dissemination of material in this information product for educational or other noncommercial purposes are authorized without any prior written permission from the copyright holders provided the source is fully acknowledged. Full acknowledgement and referencing of all sources must be included in any documentation using any of the material contained in the Harmonized World Soil Database, as follows:


FAO/IIASA/ISRIC/ISSCAS/JRC, 2009. Harmonized World Soil Database (version 1.1). FAO, Rome, Italy and IIASA, Laxenburg, Austria.


To install and load the rsofun package using the latest release run the following command in your R terminal:



To install all required packages, do:

list.of.packages <- c("dplyr", "purrr", "tidyr", "raster", "sp", "DBI", "RSQLite")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)


  1. Download the HWSD data file and extract.
  2. Move the extracted files to a local directory (in this example: "~/data/hwsd/HWSD_RASTER/hwsd.bil").


Extract values for a rectangular box:

con <- get_hwsd_con()
ans <- get_hwsd(x = c(-88.5, -88, 44, 44.5), con = con, hwsd.bil = "~/data/hwsd/HWSD_RASTER/hwsd.bil")

Extract values for one point:

con <- get_hwsd_con()
ans <- get_hwsd(x = data.frame(lon = -88, lat = 44), con = con, hwsd.bil = "~/data/hwsd/HWSD_RASTER/hwsd.bil")

Extract values for multiple points:

con <- get_hwsd_con()
ans <- get_hwsd_siteset(x = data.frame(idx = 1:2, lon = c(-88, -88.5), lat = c(44, 44.5)), con = con, hwsd.bil = "~/data/hwsd/HWSD_RASTER/hwsd.bil")

dlebauer/rhwsd documentation built on April 15, 2021, 11:45 a.m.