Stefan Kapeller — Feb 12, 2014, 10:52 AM
require(raster)
Loading required package: raster
Loading required package: sp
#Download directly from WorldClim, may take a while, if the server works at all ...
#w <- getData('worldclim', var='prec', res=10, lon=5, lat=45)
#For a list of coordinates, download worldclim data first and load it, e.g.
wc34 <- raster("./WorldClim/tmin6_34.bil", native=F)
rgdal: version: 0.8-16, (SVN revision 498)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
Path to GDAL shared files: C:/Dokumente und Einstellungen/kapeller/Eigene Dateien/R/win-library/3.0/rgdal/gdal
GDAL does not use iconv for recoding strings.
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: C:/Dokumente und Einstellungen/kapeller/Eigene Dateien/R/win-library/3.0/rgdal/proj
#Load coordinates lon and lat and extract
sites <- read.csv("Sites.csv", header = TRUE, sep = ";", dec = ".")
xy <- cbind(sites$Site_lon, sites$Site_lat)
sp <- SpatialPoints(xy)
sites_cli <- as.data.frame(cbind(sites,"tmin6" = extract(wc34, sp, method='bilinear')))