Skip to content

Soil Module

soil

Classes:

Name Description
SoilDataAccess

SoilDataAccess

Methods:

Name Description
fetch_properties

Fetches soil data based on the input value. If the input is an integer, it is used as mukey. If the input is a string, it is used as WKT.

fetch_slope_length

Fetches the slope length for a given input value. If the input is an integer, it is used as mukey. If the input is a string, it is used as WKT.

fetch_value

Fetches specific values from a given table for a given input value.

get_cokey_from_wkt

Fetches a list of cokey (Component Key) values based on a WKT spatial location.

get_mukey

Fetches the mukey for a given WKT location.

get_mukey_list

Fetches the mukey for a given WKT location.

query

Performs a query to the NRCS Soil Data Access service.

fetch_properties(input_value) staticmethod

Fetches soil data based on the input value. If the input is an integer, it is used as mukey. If the input is a string, it is used as WKT.

Args: input (int or str): The input value representing either a mukey (int) or a WKT location (str).

Returns: pd.DataFrame: A DataFrame containing the soil data for the specified input.

fetch_slope_length(input_value) staticmethod

Fetches the slope length for a given input value. If the input is an integer, it is used as mukey. If the input is a string, it is used as WKT.

Args: input (int or str): The input value representing either a mukey (int) or a WKT location (str).

Returns: float: The slope length for the specified input value.

fetch_value(input_value, values, table) staticmethod

Fetches specific values from a given table for a given input value.

Args: input_value (int or str): The input value representing either a mukey (int) or a WKT location (str). values (List[str]): A list of column names for the values to fetch. table (str): The name of the table to query.

Returns: List[Dict[str, Any]]: A list of dictionaries containing the key (mukey, cokey, etc.) and fetched values.

get_cokey_from_wkt(wkt_string) staticmethod

Fetches a list of cokey (Component Key) values based on a WKT spatial location.

Args: wkt_string (str): A WKT string representing the spatial location (e.g., POLYGON, POINT).

Returns: List[int]: A list of cokey values corresponding to the input WKT location.

get_mukey(wkt) staticmethod

Fetches the mukey for a given WKT location.

Args: wkt (str): The WKT location.

Returns: int: The mukey for the specified location.

get_mukey_list(wkt) staticmethod

Fetches the mukey for a given WKT location.

Args: wkt (str): The WKT location.

Returns: int: The mukey for the specified location.

query(query) staticmethod

Performs a query to the NRCS Soil Data Access service.

Args: query (str): The SQL query to execute.

Returns: pd.DataFrame: A DataFrame containing the results of the query.

Raises: ValueError: If no data is found for the provided query. requests.RequestException: If there is an issue with the network request.