2

I am trying to get Solar Radiation data from WorldClim version 2.0 in R, However, I am using the library raster in R but it seems to not be possible to download this data. (since there is only functions for bioclimatic data, Temperature, altitude, and precipitation)

Does anyone know how to download this data from the website using R?

I have specific coordinates. And for my bioclimatic data I have used this code, which worked:

library(raster)
library(sp)

r <- getData("worldclim",var="bio",res=10) 
r <- r[[c(1,12)]]

names(r) <- c("Temp","Prec")

lats <- c(48.45435)
lons <- c(-2.04734)

coords <- data.frame(x=lons,y=lats)
points <- SpatialPoints(coords, proj4string = r@crs)
values <- extract(r,points)
df <- cbind.data.frame(coordinates(points),values)
df
1

getData() only downloads tmean, tmin, tmax, prec, bio and alt from WorldClim v1.4. Check lines 252 to 325.

You can download files with utils::download.file() function using WorlClim data URLs, but it will download a full file, not a specific tiles as getData() does.

  • Dear Aldo , thank you very much, indeed that was what I was fearing. Following the topic, using download.file, do you know how could I get the tiles and the data for my coordinates? – Maravillas Ruiz Dec 12 '17 at 0:23
  • @MaravillasRuiz Data by tiles is only for WorldClim 1.4. I suppose in a future will be available version 2.0 by tile too – aldo_tapia Dec 12 '17 at 10:36
  • I have been able to extract the data with ArcGIS and R code, and it seems that I can extract tiles... I have values for my different coordinates. – Maravillas Ruiz Dec 13 '17 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.