I need the global SOC stocks map at 0-30cm from the new SoilGrids2.0: https://files.isric.org/soilgrids/latest/data/ocs/

I have no previous experience with VRT files. I have simply downloaded "ocs_0-30cm_mean.vrt" and "ocs_0-30cm_mean.vrt.ovr". Honestly, I don't know if I need one, the other, or both.

In R, I load it with the raster package.

soc <- raster("ocs_0-30cm_mean.vrt.ovr") # t/ha
class      : RasterLayer 
dimensions : 14509, 39812, 577632308  (nrow, ncol, ncell)
resolution : 1, 1  (x, y)
extent     : 0, 39812, 0, 14509  (xmin, xmax, ymin, ymax)
crs        : NA 
source     : ocs_0-30cm_mean.vrt.ovr 
names      : ocs_0.30cm_mean.vrt 
values     : -32768, 32767  (min, max)

However, the resolution appears to be 1 degree, when it should be 250m. The extent makes no sense (I guess it should be c(-180, 180, -90, 90), and there is no CRS.

I can plot (soc), though I don't know how to change the resolution to e.g. 0.25. I have also tried the same with "ocs_0-30cm_mean.vrt" (instead of "ocs_0-30cm_mean.vrt.ovr"), but the file does not plot

Error in rgdal::getRasterData(con, offset = offs, region.dim = c(1, nc),  : 
  Failure during raster IO

Please I would appreciate any feedback to make this raster work, with 0.25 resolution and appropriate extent.


It is better that you consult the Soilgrids FAQ mainly the section How can I download Soilgrids the webdav download describes what are the vrt and ovr files.

vrt is a virtual XML file that points to tiles creating a mosaic that behaves like a single file, therefore if you copy only the vrt to your computer you will not get anything, ovr are overviews of the vrt file

The strange numbers are the homolosine projection give it a look on the FAQ Homolosine

I am not an R programmer but you can access the files on server as a GDAL virtual file system (as if the file would be on your computer and in this case it is /vsicurl

> raster(link)
class      : RasterLayer 
dimensions : 58034, 159246, 9241682364  (nrow, ncol, ncell)
resolution : 250, 250  (x, y)
extent     : -19949750, 19861750, -6147500, 8361000  (xmin, xmax, ymin, ymax)
crs        : +proj=igh +ellps=WGS84 +units=m +no_defs 
source     : /vsicurl/https://files.isric.org/soilgrids/latest/data/ocs/ocs_0-30cm_mean.vrt 
names      : ocs_0.30cm_mean 
values     : 6, 208  (min, max)

Please pay attention that each layer is 5 gigas compressed


Using gdalwarp it is possible to convert the remote vrt file into a local geotiff.

gdalwarp -t_srs EPSG:4326 -multi -wm 200 -co BIGTIFF=YES -co COMPRESS=DEFLATE -co TILED=TRUE \

Just take create that compression is active: -co COMPRESS=DEFLATE

  • Thanks for the comment. I need the whole global layer. How can I download the many tiff files automatically?
    – fede_luppi
    May 9 '20 at 14:38
  • files.isric.org is a webdav server therefore you can check online for programs that can download multiple files from a webdav into your local drive. Or even mount webdav locally and copy files to your computer. Another approach would be to use gdal_translate to pull and convert the vrt into a geotiff with an easier projection (WGS84) (edited answer) May 10 '20 at 11:20
  • @fede_luppi In a flagged comment (which I've deleted) you expressed your opinion of the SoilGrids product and FAQ. If you want to see that improved then please contact the team who provide it. We are not a formal GIS Software Support Site and do not provide a conduit to any of those.
    – PolyGeo
    May 11 '20 at 7:11
  • @JorgeMendes thanks for tour suggestion. It runs nicely. However, values in the output tif are not correct. In the VRT file and the SoilGrids viewer SOC stocks have a legend from 0-212 t/ha. The new output tif has min=-32768, max=32767 t/ha. Do you know why and what line of your code should be modified to make it work correctly? Thanks
    – fede_luppi
    May 12 '20 at 0:07
  • There is the -dstnodata argument that can set the nodata value on the destination file (eg: -dstnodata -32768 ), the gdalwarp documentation indicates: If this argument is not used then nodata values will be copied from the source dataset, there shouldn't be any need to use it. I have tested without this argument and the downloaded file was ok. I am using GDAL 2.4.3, released 2019/10/28. So I am not certain why you have min=-32768 May 15 '20 at 8:33

Based on the answer from Jorge Mendes, I can use gdalUtils in R to read the online VRT file, transform it to a more friendly projection and resolution, and store a copy in my local disk as a .tif file:

# https://files.isric.org/soilgrids/latest/data/ocs/
gdalwarp(t_srs="EPSG:4326", multi=TRUE, wm=200, 
tr=c(0.25,0.25), # Desired output resolution
"/vsicurl?max_retry=3&retry_delay=1&list_dir=no&url=https://files.isric.org/soilgrids/latest/data/soc/soc_0-5cm_mean.vrt", # Input VRT
"soc_0-5cm_SoilGrids2.tif") # Output file
  • I have tried your code but it throws me Warning message: In system(cmd, intern = TRUE) : running command '"C:\Program Files\QGIS 3.10\bin\gdalwarp.exe" -multi -tr 0.25 0.25 -wm "200" -t_srs "EPSG:4326" -of "GTiff" -co "BIGTIFF=YES" -co "COMPRESS=DEFLATE" -co "TILED=TRUE" "/vsicurl?max_retry=3&retry_delay=1&list_dir=no&url=https://files.isric.org/soilgrids/latest/data/soc/soc_0-5cm_mean.vrt" "soc_0-5cm_SoilGrids2.tif"' had status 1. Can you please look into the issue?
    – Bappa Das
    Jul 22 '20 at 6:05

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.