The tool uses the SDA API to query and download data for the current computational region by default, and switches to a local file when an ssurgo_path is given. The data can be downloaded from USDA NRCS:
The downloaded ZIP can be passed directly — *r.in.ssurgo* reads the geodatabase inside through GDAL's virtual file system:ssurgo_path="path/to/gSSURGO_NC.zip"
.gdb directory:
ssurgo_path="path/to/gSSURGO_NC/gSSURGO_NC.gdb"
HSG (hydgrp) classifies soils by runoff potential. It is consumed by rainfall-excess models such as the SCS Curve Number method (see r.curvenumber).
The soils output is the source SSURGO Map Unit polygon vector with all
aggregated attributes attached. Use it for reference or to derive custom
rasters from the SSURGO attribute set with
v.to.rast use=attr attribute_column=<field>.
In addition to mukey / mukey_int, the soils vector carries the following dominant-component and depth-weighted attributes:
| Field | Type | Description |
|---|---|---|
cokey | TEXT | Component key of the dominant component |
comppct_r | REAL | Dominant component's percentage of the map unit |
hydgrp | TEXT | Hydrologic Soil Group |
compname | TEXT | Component name |
drainagecl | TEXT | Drainage class |
slope_r | REAL | Component slope (%) |
ksat_l / ksat_r / ksat_h | REAL | Saturated hydraulic conductivity (mm/hr); low / representative / high |
sandtotal_r | REAL | Sand content (%) |
silttotal_r | REAL | Silt content (%) |
claytotal_r | REAL | Clay content (%) |
awc_r | REAL | Available water capacity (cm/cm) |
om_r | REAL | Organic matter (%) |
dbthirdbar_r | REAL | Bulk density at 1/3 bar (g/cm³) |
ph1to1h2o_r | REAL | Soil reaction (pH 1:1 H₂O) |
cec7_r | REAL | Cation exchange capacity at pH 7 (meq/100 g) |
Depth-weighted REAL fields are aggregated as
SUM(thk × value) / SUM(thk) over horizons that overlap the
requested depth range, where thk is each horizon's thickness
clipped to that range.
comppct_r
within each map unit). A weighted-component method is planned.
len(depths) - 1.
hzdept_r and hzdepb_r are ignored when depths is
set; the aggregation runs once per slice.
hydgrp and mukey remain 2D — they're profile-level /
identity values, not depth-dependent. The 3D region is set with
b=0, t=max(depths) so the z-axis represents depth (cm) from
the surface.
r.in.ssurgo \
ssurgo_path="gSSURGO_NC.zip" \
soils="soil_areas" \
hydgrp="hydgrp" \
ksat_r="ksat_r" \
depths="0,15,30,60,100" \
desgnmaster="A"
# produces: hydgrp (2D), ksat_r (3D, 4 slices)
ksat_r__s0,
ksat_r__s1, ...) also appear on the soils vector so
you can query them with v.db.select or rasterize any one
slice with v.to.rast use=attr.
ogr2ogr + Python stdlib
sqlite3 implementation otherwise. The -s flag forces the
SQLite/OGR backend even when DuckDB is importable, which is useful for
testing the fallback path. The flag has no effect on SDA queries.
ogr2ogr and the FlatGeobuf driver.pip install duckdb. The SQLite fallback is used
automatically when DuckDB is not available.
r.in.ssurgo \
ssurgo_path="gSSURGO_NC.zip" \
soils="soil_areas" \
hydgrp="hydgrp" \
ksat_l="ksat_l" \
ksat_r="ksat_r" \
ksat_h="ksat_h" \
mukey="mukey" \
hzdept_r=0 \
hzdepb_r=100 \
desgnmaster="A"
grass.script):
gs.run_command(
"r.in.ssurgo",
ssurgo_path="gSSURGO_NC.zip",
soils="soils",
hydgrp="hydgrp",
ksat_l="ksat_l",
ksat_r="ksat_r",
ksat_h="ksat_h",
mukey="mukey",
hzdept_r=0,
hzdepb_r=100,
desgnmaster="A",
)
grass.tools):
tools = Tools()
tools.r_in_ssurgo(
ssurgo_path="../data/gSSURGO_CONUS.zip",
soils="soils",
hydgrp="hydgrp",
ksat_l="ksat_l",
ksat_r="ksat_r",
ksat_h="ksat_h",
mukey="mukey",
hzdept_r=0,
hzdepb_r=100,
desgnmaster="A",
)
r.in.ssurgo -s \
ssurgo_path="gSSURGO_NC.zip" \
soils="soils" \
hydgrp="hydgrp" \
ksat_r="ksat_r" \
hzdept_r=0 \
hzdepb_r=100 \
desgnmaster="A"
tools.r_in_ssurgo(
ssurgo_path="../data/gSSURGO_CONUS.zip",
soils="soils",
hydgrp="hydgrp",
ksat_r="ksat_r",
hzdept_r=0,
hzdepb_r=100,
desgnmaster="A",
flags="s",
)
r.in.ssurgo \
soils="soils" \
hydgrp="hydgrp" \
ksat_l="ksat_l" \
ksat_r="ksat_r" \
ksat_h="ksat_h" \
mukey="mukey" \
hzdept_r=0 \
hzdepb_r=100 \
desgnmaster="A"
r.in.ssurgo was developed as part of an agreement between the U.S. Department of Agriculture (USDA), Natural Resources Conservation Service (NRCS) and North Carolina State University (NCSU) to adapt the SIMulation of Water and Erosion (SIMWE) model for the integration of Dynamic Soil Survey data.
Available at: r.in.ssurgo source code (history)
Latest change: Wednesday Jul 15 06:13:42 2026 in commit: 6f000f937de28c770c20049ccee90c83d52310f1
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2026 GRASS Development Team, GRASS 8.5.1dev Reference Manual