Learn R Programming

GSIF (version 0.3-1)

afsp: Africa Soil Profiles Database

Description

A subset of the http://africasoils.net/data/legacyprofile{Africa Soil Profiles Database} (AFSP) that contains over 12,000 geo-referenced legacy soil profile records for 37 countries.

Usage

data(afsp)

Arguments

encoding

latin1

References

  • Leenaars, J.G.B. (2012)http://www.isric.org/content/publications{Africa Soil Profiles Database, Version 1.0. A compilation of geo-referenced and standardized legacy soil profile data for Sub Saharan Africa (with dataset)}. ISRIC report 2012/03. Africa Soil Information Service (AfSIS) project and ISRIC --- World Soil Information, Wageningen, the Netherlands.
  • Africa Soil Information Service (http://africasoils.net)

Examples

Run this code
library(rgdal)
library(aqp)
library(sp)

data(afsp)
sites <- afsp$sites
coordinates(sites) <- ~ LONWGS84 + LATWGS84
proj4string(sites) <- "+proj=latlong +datum=WGS84"
## obtain country borders:
library(maps)
country.m = map('world', plot=FALSE, fill=TRUE)
IDs <- sapply(strsplit(country.m$names, ":"), function(x) x[1])
require(maptools)
country <- as(map2SpatialPolygons(country.m, IDs=IDs), "SpatialLines")
proj4string(country) = "+proj=latlong +datum=WGS84" 
## overlay and plot points and maps:
plot(country, col="darkgrey", xlim=c(-25.3,57.8), ylim=c(-34.8, 37.4))
points(sites, pch=21, bg="white", cex=.6, col="black")
## load gridded data for whole of Africa:
download.file("http://worldgrids.org/rda/afgrid20.rda", "afgrid20.rda")
load("afgrid20.rda")
## plot maps:
col = grey(rev(seq(0.1,0.975,0.025)))
names(afgrid20)
lns = list("sp.lines", spTransform(country, afgrid20@proj4string))
spplot(afgrid20["TDMMOD0a"], col.regions=col, sp.layout=lns)
## write to a GIS format:
writeGDAL(afgrid20["TDMMOD0a"], "TDMMOD0a.tif", "GTiff", mvFlag=-99999)

Run the code above in your browser using DataLab