Skip to content

fix: allow soilweb URL to be overridden with environment variable #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions soil_id/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# US Soil ID
STATSGO_PATH = f"{DATA_PATH}/gsmsoilmu_a_us.shp"
MUNSELL_RGB_LAB_PATH = f"{DATA_PATH}/LandPKS_munsell_rgb_lab.csv"
SOILWEB_URL = os.environ.get("SOILWEB_URL", "https://soilmap4-1.lawr.ucdavis.edu/api/landPKS.php")

# Global Soil ID
HWSD_PATH = f"{DATA_PATH}/HWSD_global_noWater_no_country.shp"
Expand Down
3 changes: 2 additions & 1 deletion soil_id/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import pandas as pd
import requests

from .config import SOILWEB_URL
from .db import save_soilgrids_output


Expand Down Expand Up @@ -162,7 +163,7 @@ def get_soilweb_data(lon, lat):
Returns:
dict: A dictionary containing soil data or error information if the request fails.
"""
base_url = "https://soilmap4-1.lawr.ucdavis.edu/api/landPKS.php"
base_url = SOILWEB_URL
params = {
"q": "spn", # Query type - static for this function's purpose
"lon": lon,
Expand Down
Loading