SoilGrid API – Retrieving SoilGrid Data per x,y Coordinates Using Python

apipythonsoilgrids

In the past I was able to get SoilGrid data per x,y coordinates (lat,lon) using Python with the below URL:

url = f'https://rest.soilgrids.org/soilgrids/v2.0/properties/query?lon={lon}&lat={lat}'

I haven't used this API in a long time and now I see it has changed. According to here they added a new argument subsets which takes in a list of tuples, one tuple per axis, and the result is a raster/matrix according to the subset. I would like to get data the old way, providing lat,lon, and get data as JSON.

Is it still possible to get data per lat,lon via Python?

Best Answer

What's changed is the host. Use rest.isric.org instead of rest.soilgrids.org.

wget "https://rest.isric.org/soilgrids/v2.0/properties/query?lon=34.5&lat=1.299" returns a big chunk of JSON data which is probably what you want.

Related Question