-
Notifications
You must be signed in to change notification settings - Fork 1
REST API
The Spatial Data Library is a web service to retrieve Worldclim (Hijmans et al. 2006) variables from a high-performance data store.
| Parameter | Description | Example |
| xy | Get cells from longitude/latitude pairs, separated by commas (","). List pairs separated by pipes ("|"). |
xy=42.88,-0.008 xy=42.8,-0.008|42.88,-0.008 |
| k | Cell keys to get, separated by commas (",") | k=28037-11350 k=28036-11350,28037-11350 |
| v | Show variables in response. Variable names separated by commas (","). Omit parameter to get all variables. |
v=tmax12 v=tmax10,tmax11,tmax12 |
| c | Show coordinates in response if true. | c=true |
| si | Converts variable values to SI units if true. | si=true |
###Example Get values of tmax10, tmax11, and tmax12 for the cell having key '28037-11350' and include the coordinates for the cell in the response.
GET /api/cells/values?k=28037-11350&v=tmax10,tmax11,tmax12&c=true&si=true
Example JSON response
[
{
"cell_key":"28037-11350",
"cell_coords":[
[
"55.9520559",
"-4.5833333"
],
[
"55.9520559",
"-4.5916667"
],
[
"55.9604717",
"-4.5916667"
],
[
"55.9604717",
"-4.5833333"
],
[
"55.9520559",
"-4.5833333"
]
],
"cell_values":{
"tmax12":28.3,
"tmax11":28.9,
"tmax10":28.3
}
}
]
###Example Get values of all variables for the cells at geographic locations lon/lat 42.8,-0.008 and 42.88,-0.008 and do not include the coordinates for the cell in the response.
GET /api/cells/values?xy=42.8,-0.008|42.88,-0.008
Example JSON response
[
{
"cell-values":
{
"tmax12": "323", "tmax11": "317", "tmax10": "314",
...
"bio3": "77"
},
"cell-key":
"26557-10800"
},
{
"cell-values":
{
"tmax12": "318", "tmax11": "313", "tmax10": "310",
...
"bio3": "78"
},
"cell-key":
"26566-10800"
}
]
###Example List all variables.
GET /api/variables
Example JSON response
[
{
"bio1": {
"maxval": 293,
"name": "Annual Mean Temperature",
"created": "2006-01-04 00:00:00",
"minval": -50,
"datum": "WGS84",
"database": "WorldClim",
"version": "1.4",
"key": "bio1",
"release": 3,
"projection": "Geographic"
},
...
}
]
###Example List metadata for variable bio1.
GET /api/variables/bio1
Example JSON response
{
"maxval": 293,
"name": "Annual Mean Temperature",
"created": "2006-01-04 00:00:00",
"minval": -50,
"datum": "WGS84",
"database": "WorldClim",
"version": "1.4",
"key": "bio1",
"release": 3,
"projection": "Geographic"
}
###Example Get all bio1 variable cell values that are between 0 and 10, inclusive.
GET api/cells/values?within=5&pivot=5&variable=bio1&limit=10&offset=0
| Parameter | Description |
| within | Look for values within this range |
| pivot | Look for values within range of this pivot value |
| variable | The cell variable |
| limit | The max number of cells to return (for paging) |
| offset | The starting point offset of cells to return (for paging) |
Example JSON response
[
{"cell-key": "1-2", "cell-value": 8},
...
]