Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions soil_id/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,14 @@ def get_soilgrids_classification_data(lon, lat):
return result


def get_soilweb_data(lon, lat):
def get_soilweb_data(lon, lat, radius_m=1000):
"""
Fetch SSURGO data from the SoilWeb API for a specified longitude and latitude.

Args:
lon (float): Longitude of the location for which to fetch soil data.
lat (float): Latitude of the location for which to fetch soil data.
radius_m (int, optional): Radius in meters to search for soil data around the specified location. Default is 1000 meters.

Returns:
dict: A dictionary containing soil data or error information if the request fails.
Expand All @@ -158,7 +159,7 @@ def get_soilweb_data(lon, lat):
"q": "spn", # Query type - static for this function's purpose
"lon": lon,
"lat": lat,
"r": 1000, # Radius (in TODO: units)
"r": radius_m, # Radius in meters
}
result = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@
}
},
"texture": {
"sl1": "Unknown",
"sl2": "Unknown",
"sl3": "Unknown",
"sl4": "Unknown",
"sl5": "Unknown",
"sl6": "Unknown",
"sl7": "Unknown"
"sl1": "Clay",
"sl2": "Clay",
"sl3": "Clay",
"sl4": "Clay",
"sl5": "Clay",
"sl6": "Clay",
"sl7": "Clay"
}
},
{
Expand Down Expand Up @@ -722,16 +722,35 @@
"model": "v2"
},
"soilRank": [
{
"component": "Dystric gleysols",
"componentData": "Data Complete",
"componentID": 148189,
"name": "Dystric gleysols",
"not_displayed": false,
"rank_data": "1",
"rank_data_group": "1",
"rank_data_loc": "1",
"rank_data_loc_group": "1",
"rank_loc": 6,
"rank_loc_group": 6,
"score_data": 1.0,
"score_data_group": 1.0,
"score_data_loc": 0.508,
"score_data_loc_group": 0.508,
"score_loc": 0.017,
"score_loc_group": 0.017
},
{
"component": "Haplic ferralsols",
"componentData": "No Data",
"componentData": "Data Complete",
"componentID": 156034,
"name": "Haplic ferralsols",
"not_displayed": false,
"rank_data": "3",
"rank_data_group": "3",
"rank_data_loc": "1",
"rank_data_loc_group": "1",
"rank_data": "4",
"rank_data_group": "4",
"rank_data_loc": "2",
"rank_data_loc_group": "2",
"rank_loc": 2,
"rank_loc_group": 2,
"score_data": 0.571,
Expand All @@ -749,8 +768,8 @@
"not_displayed": false,
"rank_data": "6",
"rank_data_group": "6",
"rank_data_loc": "2",
"rank_data_loc_group": "2",
"rank_data_loc": "3",
"rank_data_loc_group": "3",
"rank_loc": 1,
"rank_loc_group": 1,
"score_data": 0.35,
Expand All @@ -766,10 +785,10 @@
"componentID": 144042,
"name": "Ferralic cambisols",
"not_displayed": false,
"rank_data": "1",
"rank_data_group": "1",
"rank_data_loc": "3",
"rank_data_loc_group": "3",
"rank_data": "2",
"rank_data_group": "2",
"rank_data_loc": "4",
"rank_data_loc_group": "4",
"rank_loc": 4,
"rank_loc_group": 4,
"score_data": 0.621,
Expand All @@ -785,10 +804,10 @@
"componentID": 148190,
"name": "Dystric fluvisols",
"not_displayed": false,
"rank_data": "2",
"rank_data_group": "2",
"rank_data_loc": "4",
"rank_data_loc_group": "4",
"rank_data": "3",
"rank_data_group": "3",
"rank_data_loc": "5",
"rank_data_loc_group": "5",
"rank_loc": 5,
"rank_loc_group": 5,
"score_data": 0.571,
Expand All @@ -798,28 +817,9 @@
"score_loc": 0.017,
"score_loc_group": 0.017
},
{
"component": "Dystric gleysols",
"componentData": "Missing Data",
"componentID": 148189,
"name": "Dystric gleysols",
"not_displayed": false,
"rank_data": "4",
"rank_data_group": "4",
"rank_data_loc": "5",
"rank_data_loc_group": "5",
"rank_loc": 6,
"rank_loc_group": 6,
"score_data": 0.519,
"score_data_group": 0.519,
"score_data_loc": 0.268,
"score_data_loc_group": 0.268,
"score_loc": 0.017,
"score_loc_group": 0.017
},
{
"component": "Gleyic acrisols",
"componentData": "Missing Data",
"componentData": "Data Complete",
"componentID": 144045,
"name": "Gleyic acrisols",
"not_displayed": false,
Expand All @@ -838,7 +838,7 @@
},
{
"component": "Xanthic ferralsols",
"componentData": "Missing Data",
"componentData": "Data Complete",
"componentID": 156033,
"name": "Xanthic ferralsols",
"not_displayed": false,
Expand Down
Loading
Loading