WebDAV: direct access to SoilGrids maps in VRT format

SoilGrids files in VRT format are hosted on the WebDAV. They can be easily accessed using your file browser and different programming languages. 
 

File browser access

Windows 10
  • Open file explorer
  • Right click on This PC and choose Add a network location
  • Click next
  • Select "Choose a custom network location`
  • Click next
  • Enter https://files.isric.org/soilgrids/latest/data/  for Internet or network location
  • Click next
  • Choose a name for the connection (or accept the suggestion)
  • Click next
  • Click Finish

 

If you are asked for credentials use 'anonymous' for both user and password.

Linux/Unix

Open your favourite file explorer and type

davs://files.isric.org/soilgrids/latest/data/

Programmatical access

We will provide examples on how to access SoilGrids data hosted on the WebDAV, in three common languages (R,python and linux bash) for a test area.

If you would like to have the whole globe, the bounding box parameters (in Homolosine) are:

-20037500 -6729000 20037500 8600750

Please be aware that running the examples below for the whole globe may require some time, disk space and computational resources.

 

R

Load libraries, select boundary box and cell size

Initially you need to load the following libraries and select the bounding box of the area you are interested in:

library(rgdal)
library(gdalUtils)

bb=c(-337500.000,1242500.000,152500.000,527500.000) # Example bounding box (homolosine)
igh='+proj=igh +lat_0=0 +lon_0=0 +datum=WGS84 +units=m +no_defs' # proj string for Homolosine projection

To a geotiff in Homolosine

This GDAL command will create a local geotiff in the Homolosine projection

gdal_translate(
   '/vsicurl?max_retry=3&retry_delay=1&list_dir=no&url=https://files.isric.org/soilgrids/latest/data/ocs/ocs_0- 30cm_mean.vrt', 
   "./crop_roi_igh_r.tif",
   tr=c(250,250),
   projwin=bb,
   projwin_srs =igh,
   verbose=TRUE
)

To a geotiff in a different projection

The following commands describe a workflow to obtain a VRT or a GeoTiff for an area of interest in a projection of your choice. In this example we will use EPSG=4326

To local VRT in homolosine (directly from the webdav connection)

The first step is to obtain a VRT for the area of interest in the Homolosine projection. We suggest to use VRT for the intermediate steps to save space and computation times.

gdal_translate(
   '/vsicurl?max_retry=3&retry_delay=1&list_dir=no&url=https://files.isric.org/soilgrids/latest/data/ocs/ocs_0-30cm_mean.vrt',
   "./crop_roi_igh_r.vrt",
    of="VRT",
    tr=c(250,250),
    projwin=bb,
    projwin_srs =igh,
    verbose=TRUE
)
To a VRT in, for example, LatLong

The following command will generate a VRT in the projection of your choice:

gdalwarp(
   "./crop_roi_igh_r.vrt",
   "./crop_roi_ll_r.vrt",
   s_src=igh, 
   t_srs="EPSG:4326", 
   of="VRT"
)
To a final Geotiff

The following command will generate a Geotiff in the projection of your choice for the area of interest defined above

gdal_translate(
   "./crop_roi_ll_r.vrt",  
   "./crop_roi_ll_r.tif", 
   co=c("TILED=YES","COMPRESS=DEFLATE","PREDICTOR=2","BIGTIFF=YES")
)

 

python3

Import packages, select boundary box and cell size

Initially you need to import the following package and select the bounding box of the area you are interested in:

from osgeo import gdal,ogr,osr

bb=-337500.000,1242500.000,152500.000,527500.000 # Example of bounding box in Homolosine
igh='+proj=igh +lat_0=0 +lon_0=0 +datum=WGS84 +units=m +no_defs' # proj string for the Homosoline projection
res=250 # Resolution of SoilGrids maps

To a geotiff in Homolosine

This GDAL command will create a local geotiff in the Homolosine projection

kwargs = {'format': 'GTiff', 'projWin': bb, 'projWinSRS': igh, 'xRes': res, 'yRes': res, 'creationOptions': ["TILED=YES", "COMPRESS=DEFLATE", "PREDICTOR=2", "BIGTIFF=YES"]}

ds = gdal.Translate('./crop_roi_igh_py.tif', 
                    '/vsicurl?max_retry=3&retry_delay=1&list_dir=no&url=https://files.isric.org/soilgrids/latest/data/ocs/ocs_0-30cm_mean.vrt', 
                    **kwargs)
del ds

To a geotiff in a different projection

The following commands describe a workflow to obtain a VRT or a GeoTiff for an area of interest in a projection of your choice. In this example we will use EPSG=4326

To local VRT in homolosine (directly from the webdav connection)

The first step is to obtain a VRT for the area of interest in the Homolosine projection. We suggest to use VRT for the intermediate steps to save space and computation times.

kwargs = {'format': 'GTiff', 'projWin': bb, 'projWinSRS': igh, 'xRes': res, 'yRes': res}

ds = gdal.Translate('./crop_roi_igh_py.vrt', 
                    '/vsicurl?max_retry=3&retry_delay=1&list_dir=no&url=https://files.isric.org/soilgrids/latest/data/ocs/ocs_0-30cm_mean.vrt', 
                    **kwargs)
del ds
To a VRT in, for example, LatLong

The following command will generate a VRT in the projection of your choice:

ds = gdal.Warp('./crop_roi_ll_py.vrt', './crop_roi_igh_py.vrt', dstSRS='EPSG:4326')
del ds
To a final Geotiff

The following command will generate a Geotiff in the projection of your choice for the area of interest defined above

kwargs = {'format': 'GTiff', 'creationOptions': ["TILED=YES", "COMPRESS=DEFLATE", "PREDICTOR=2", "BIGTIFF=YES"] }
ds = gdal.Translate('./crop_roi_ll_py.tif','./crop_roi_ll_py.vrt', **kwargs)
del ds

 

Linux Bash

select boundary box and cell size

The first step is to select the bounding box of your choice

BOUNDS=-337500.000 1242500.000 152500.000 527500.000
CELL_SIZE=250 250

To a geotiff in Homolosine

This GDAL command will create a local geotiff in the Homolosine projection

gdal_translate -projwin $BOUNDS -tr $CELL_SIZE \
   -co "TILED=YES" -co "COMPRESS=DEFLATE" -co "PREDICTOR=2" -co "BIGTIFF=YES" \
"/vsicurl?max_retry=3&retry_delay=1&list_dir=no&url=https://files.isric.org/soilgrids/latest/data/ocs/ocs_0-30cm_mean.vrt" \
   "ocs_0-5cm_mean.tif"

To a geotiff in a different projection

The following commands describe a workflow to obtain a VRT or a GeoTiff for an area of interest in a projection of your choice. In this example we will use EPSG=4326

To local VRT in homolosine (directly from the webdav connection)

The first step is to obtain a VRT for the area of interest in the Homolosine projection. We suggest to use VRT for the intermediate steps to save space and computation times.

gdal_translate -of VRT -projwin $BOUNDS -tr $CELL_SIZE -co "TILED=YES" \ 
   -co "COMPRESS=DEFLATE" -co "PREDICTOR=2" -co "BIGTIFF=YES" \
    "/vsicurl?max_retry=3&retry_delay=1&list_dir=no&url=https://files.isric.org/soilgrids/latest/data/ocs/ocs_0-30cm_mean.vrt" \
   "ocs_0-5cm_mean.vrt"
To a VRT in, for example, LatLong

The following command will generate a VRT in the projection of your choice:

gdalwarp -overwrite -t_srs EPSG:4326 -of VRT "ocs_0-5cm_mean.vrt" "ocs_0-5cm_mean_4326.vrt"
To a final Geotiff

The following command will generate a Geotiff in the projection of your choice for the area of interest defined above

gdal_translate ocs_0-5cm_mean_4326.vrt ocs_0-5cm_mean_4326.tif \
   -co "TILED=YES" -co "COMPRESS=DEFLATE" \ 
   -co "PREDICTOR=2" -co "BIGTIFF=YES"

 

 

 

Contact: