Mast head image

SVI-related soil properties

This script retrieves soil properties for the soil vulnerability index.

The headers were not changed from the original script.


Text highlighted in yellow in the example script can be changed for a particular area, or you can use wildcards to get an entire State. Examples can be found on the Tips page.

Tips Page

Copy the example script below and paste it into the query page on the Soil Data Access site.

Soil Data Access Query Page

Example Script

SELECT LEFT((areasymbol), 2) AS state

, l.areasymbol, l.areaname, mu.mukey, mu.musym, mu.nationalmusym, mu.muname, mukind, mu.muacres

, c.majcompflag, c.comppct_r, c.compname, c.cokey, compkind

, (mu.muacres*c.comppct_r/100) AS compacres, localphase, slope_l,

CASE WHEN slope_r IS NULL THEN (slope_l+slope_h/2)

ELSE slope_r END AS slope_r,

CASE WHEN slope_r = 0 THEN .1 ELSE slope_r END AS slope, slope_h, hydgrp,

CASE WHEN (100-sieveno10_r) = 0 THEN 1

ELSE (100-sieveno10_r) END AS sur_hor_frags,

(100-sieveno10_r) AS A_hor_frags , sieveno10_r , kffact , kwfact

, (SELECT CASE

WHEN hydgrp = 'A' THEN 8

WHEN hydgrp = 'B' THEN 6

WHEN hydgrp = 'C' THEN 4

WHEN hydgrp = 'D' THEN 2

WHEN hydgrp = 'A/D' THEN 8

WHEN hydgrp = 'B/D' THEN 6

WHEN hydgrp = 'C/D' THEN 4

ELSE 1

END) AS svi_leaching

, (SELECT CASE

WHEN hydgrp = 'A' THEN 2

WHEN hydgrp = 'B' THEN 4

WHEN hydgrp = 'C' THEN 6

WHEN hydgrp = 'D' THEN 8

WHEN hydgrp = 'A/D' THEN 2

WHEN hydgrp = 'B/D' THEN 4

WHEN hydgrp = 'C/D' THEN 6

ELSE 1

END) AS svi_runoff

INTO #SVI

FROM legend AS l

INNER JOIN mapunit AS mu ON mu.lkey = l.lkey

INNER JOIN component AS c ON c.mukey = mu.mukey AND compkind NOT LIKE 'miscellaneous area' AND l.areasymbol LIKE 'IA001'

INNER JOIN chorizon ch ON ch.cokey = c.cokey AND hzdept_r = 0

ORDER BY l.areasymbol, mu.musym

SELECT

mukey, cokey

, (svi_runoff*slope*sur_hor_frags*kffact) AS SVI_runoff_Index , (SELECT CAST(CASE

WHEN hydgrp LIKE 'B%' AND slope >6 THEN 4

WHEN hydgrp LIKE 'C%' AND slope >6 THEN 4

WHEN hydgrp LIKE 'D%' AND slope >4 THEN 4

WHEN hydgrp LIKE 'B%' AND (slope >= 4 AND slope <= 6) AND kffact >= 0.32 THEN 3

WHEN hydgrp LIKE 'C%' AND (slope >= 2 AND slope <= 6) AND kffact >= 0.28 THEN 3

WHEN hydgrp LIKE 'D%' AND (slope >= 2 AND slope <= 4) THEN 3

WHEN hydgrp LIKE 'B%' AND (slope >= 4 AND slope <= 6) AND kffact < 0.32 THEN 2

WHEN hydgrp LIKE 'C%' AND (slope >= 2 AND slope <= 6) AND kffact < 0.28 THEN 2

WHEN hydgrp LIKE 'D%' AND slope >= 2 AND kffact >= 0.28 THEN 2

WHEN hydgrp LIKE 'D%' AND slope < 2 AND kffact < 0.28 THEN 2

WHEN hydgrp LIKE 'C%' AND slope < 2 THEN 1

WHEN hydgrp LIKE 'B%' AND slope < 4 THEN 1

WHEN hydgrp LIKE 'A%' THEN 1

ELSE 0 END AS real)) AS SVI_Runoff_B

, (svi_leaching*slope*sur_hor_frags*kffact) AS SVI_Leaching_Index , (SELECT CAST (CASE

WHEN hydgrp LIKE 'A%'and slope <= 12 THEN 4

WHEN hydgrp LIKE 'B%'and slope < 3 AND kffact < 0.24 THEN 4

WHEN hydgrp LIKE 'A%'and slope > 12 THEN 3

WHEN hydgrp LIKE 'B%'and (slope >= 3 AND slope <= 12) AND kffact < 0.24 THEN 3

WHEN hydgrp LIKE 'B%'and slope <= 12 AND kffact >= 0.24 THEN 2

WHEN hydgrp LIKE 'B%'and slope > 12 THEN 2

WHEN hydgrp LIKE 'C%' THEN 2

WHEN hydgrp LIKE 'D%' THEN 1

ELSE 0 END AS INT)) AS SVI_Leach_B

INTO #SVI1

FROM #SVI

SELECT

state, areasymbol, areaname, #SVI.mukey, musym, nationalmusym, muname, mukind, muacres, majcompflag

, #SVI.cokey, comppct_r, compname, compkind, compacres, localphase, slope_l, slope_r, slope_h

, hydgrp, svi_leaching, svi_runoff, slope, A_hor_frags, sieveno10_r, kffact, kwfact, SVI_Leaching_Index

, (SELECT CAST (CASE WHEN SVI_Leach_B = 1 AND sur_hor_frags >= 30 THEN 3

WHEN SVI_Leach_B = 2 AND sur_hor_frags >= 30 THEN 4

WHEN SVI_Leach_B = 3 AND sur_hor_frags >= 30 THEN 4

WHEN SVI_Leach_B = 1 AND (sur_hor_frags > 10 AND sur_hor_frags < 30) THEN 2

WHEN SVI_Leach_B = 2 AND (sur_hor_frags > 10 AND sur_hor_frags < 30) THEN 3

WHEN SVI_Leach_B = 3 AND (sur_hor_frags > 10 AND sur_hor_frags < 30) THEN 4

ELSE SVI_Leach_B END AS real)) AS Leach , SVI_Leach_B , SVI_runoff_Index , SVI_Runoff_B

FROM #SVI

INNER JOIN #SVI1 ON #SVI.cokey=#SVI1.cokey

ORDER BY areasymbol, musym

DROP TABLE #SVI1

DROP TABLE #SVI

Example Table Output

Column headers were not changed from the original script.

Description of tables and columns can be found on this link: Table and Column Descriptions

state areasymbol areaname mukey musym nationalmusym muname mukind muacres majcompflag cokey comppct_r compname compkind compacres localphase slope_l slope_r slope_h hydgrp svi_leaching svi_runoff slope A_hor_frags sieveno10_r kffact kwfact SVI_Leaching_Index Leach SVI_Leach_B SVI_runoff_Index SVI_Runoff_B
IA IA001 Adair County, Iowa 402143 11B 2wnyp Colo, occasionally flooded-Ely silty clay loams, dissected till plain, 2 to 5 percent slopes Complex 48103 Yes 13341801 60 Colo Series 28861 occasionally flooded 2 4 5 C/D 4 6 4 0 100 .28 .28 4.48 2 2 6.72 3
IA IA001 Adair County, Iowa 402146 13B fhgg Vesser-Nodaway silt loams, 2 to 5 percent slopes Complex 891 No 13341553 5 Perks Series 44 frequently flooded 0 1 2 A 8 2 1 7.5 92.5 4 4 1
IA IA001 Adair County, Iowa 402218 Y93E2 2wxs3 Shelby-Adair clay loams, dissected till plain, 14 to 18 percent slopes, eroded Complex 1916 No 13341833 5 Sharpsburg Taxadjunct 95 eroded 14 16 18 C 4 6 16 0 100 .37 .37 23.68 2 2 35.52 4



Helping People Help the Land

USDA is an equal opportunity provider, employer, and lender.