What is WCS
The Web Coverage Service (WCS) is a standard issued by the Open Geospatial Consortium (OGC). It is designed to simplify remote access to coverages, commonly known as raster maps in GIS. WCS functions over the HTTP protocol, setting out how to obtain data and meta-data using the requests available in that protocol. In practice it allows raster maps to be obtained from a web browser or from any other programme that uses the protocol.
All SoilGrids maps are available through WCS, this being the most convenient way of obtaining spatial subsets of the various predictions. Most GIS software support WCS, either as servers (e.g. MapServer, GeoServer) or as clients (e.g. QGis, ESRI). WCS is also supported by programming languages popular in data science, such as R and Python. For Python, the OWSLib library makes access to WCS fairly simple.
The standard is composed by three core requests, each with a particular purpose:
1 - GetCapabilities
2 - DescribeCoverage
3 - GetCoverage
Each of these are explained in more detail below, with examples using SoilGrids maps.
GetCapabilities
This request provides information on a particular service: maps available, their extent and available CRS for query. For each different soil property predicted in SoilGrids there is an independent service. Check the web page maps.isric.org for all the services available.
Example of GetCapabilities
request for the Nitrogen property:
https://maps.isric.org/mapserv?map=/map/nitrogen.map&
SERVICE=WCS&
VERSION=2.0.0&
REQUEST=GetCapabilities
The parameters simply the indicate the type of service, its version and the request type itself. A SoilGrids WCS will typically return a list of 24 coverages (maps), combining six standard depth intervals with four quantiles.
DescribeCoverage
To obtain more detailed information about on a particular coverage there is the DescribeCoverage
request. This request requires an additional parameter: COVERAGEID
with the short identifier of the coverage to be queried. These identifiers are present in the response to the DescribeCoverage
request.
https://maps.isric.org/mapserv?map=/map/nitrogen.map&
SERVICE=WCS&
VERSION=2.0.0&
REQUEST=DescribeCoverage&
COVERAGEID=nitrogen_5-15cm_Q0.5
The example above returns the meta-data for the median Nitrogen prediction within the 5 to 15 cm depth interval.
GetCoverage
Finally, the request that actually obtains the data: GetCoverage
. Beyond the parameters provided with the DescribeCoverage
request, basic information is now necessary to spatially delimit the request and define its outputs. This operation is also known as trimming in WCS, since it trims the map along its spatial dimensions. The SUBSET
parameter defines the extent for a particular dimension, therefore two are necessary to express easting and northing extents. Two different coordinate systems may be defined, one for the SUBSET
parameters - SUBSETTINGCRS
- and another for the final map output - OUTPUTCRS
. Finally, FORMAT
defines the data type of the resulting map. Here is an example again with Nitrogen:
https://maps.isric.org/mapserv?map=/map/nitrogen.map&
SERVICE=WCS&
VERSION=2.0.1&
REQUEST=GetCoverage&
COVERAGEID=nitrogen_5-15cm_Q0.5&
FORMAT=GEOTIFF_INT16&
SUBSET=X(-1784000,-1140000)&
SUBSET=Y(1356000,1863000)&
SUBSETTINGCRS=http://www.opengis.net/def/crs/EPSG/0/152160&
OUTPUTCRS=http://www.opengis.net/def/crs/EPSG/0/152160
Further reading
Knowing the parameters of each request, WCS becomes fairly simple to use. But it can become even simpler using a specific library like OWSLib. The gist of this library used with SoilGrids is provided in this collection of Jupyter notebooks.
Examples of how to use WCS with R and GDAL tools is provided in this page.