Soil Science Society of America Journal 63:807-808 (1999)
© 1999 Soil Science Society of America
DIVISION S-1-SOIL PHYSICS
A Computer Program for Soil Textural Classification
Argyrios Gerakisa and
Brian Baera
a Dep. of Crop and Soil Sciences, Plant and Soil Sciences Building, Michigan State Univ., East Lansing, MI 48824-1325 USA
gerakis{at}pilot.msu.edu
 |
ABSTRACT
|
|---|
Manual classification of soils into textural classes with the USDA textural triangle is tedious. This computer program can perform the same task easier and faster. The algorithm is based on the fact that each point in the textural triangle represents a unique combination of sand and clay content. For a given textural class, all combinations of sand and clay content are bound by a polygon. Finding the textural class is equivalent to finding the polygon where a particular combination of sand and clay is located. Both a World Wide Web interactive version and a Windows 95 console program are available. On a 133 MHz Pentium microcomputer, the Windows version can classify 1000 soil samples in about a second.
 |
INTRODUCTION
|
|---|
PARTICLE-SIZE ANALYSIS often is used to evaluate soil texture. Once the particle-size fractions (sand, silt, and clay) are measured, a textural triangle such as the USDA triangle is used to classify the soil (Fig. 1)
. The sides of the triangle have scales for sand, clay, and often silt content. Each point in the textural triangle represents a unique combination of sand and clay content. For a given textural class, all combinations of sand and clay content are bound by a polygon that bears the name of the class. The procedure of textural classification using the triangle is tedious and slow, especially for a large number of samples.

View larger version (31K):
[in this window]
[in a new window]
|
Fig. 1 The USDA textural triangle. The vector V extending from point A parallel to the positive y-axis crosses one edge of the "sandy loam" polygon; therefore, point A is inside the polygon. Points B and C are borderline cases explained in the text
|
|
There have been computer programs to automate the task of textural classification. The Gee and Bauder (1986) program works in a now outdated computing environment. The Gent (1983) program works only with inputs from a modified hydrometer method. The van Rooyen and Visser (1976) program is based on the South African textural triangle and accepts inputs only from a simplified hydrometer method. Christopher and Mokhtaruddin (1996) offer a useful spreadsheet macro, but it is limited to two types of spreadsheets for the Windows operating system. None of the above papers explain how their classification algorithms work; therefore their approaches cannot be evaluated.
This paper presents a new computer program for textural classification. It can be used interactively on the World Wide Web or as a Windows 95 console program for batch processing of soil analysis results. It is possible to compile the code (available to download) on other operating systems with a Fortran compiler. The output of the program is a text file that can be readily imported to spreadsheets.
 |
Program Description and Operation
|
|---|
The USDA triangle actually is a two-axis coordinate system. The objective of the program is to determine whether a test point of known coordinates (sand percentage and clay percentage) lies inside a polygon in the triangle.
Several point-in-polygon algorithms have been developed for spatial analysis applications such as computer cartography and geographic information systems (GIS) (Haralick, 1980; Nordbeck, 1962; Nordbeck and Rystedt, 1967) and more recently for World Wide Web image maps. A web image map allows the user to access additional information by pointing the cursor at unique polygons within the map and clicking. There are several point-in-polygon algorithms in the public domain available on the World Wide Web: Galacticomm's inpoly (http://www.gcomm.com), Apache's pointinpoly (http://www.apache.org/dist/), World Wide Web Consortium's inside-poly (http://www.w3.org/pub/WWW/Daemon/Implementation/HTImage.c), General Electric Manufacturing Technology Laboratory's inPolygon (ftp://ce-toolkit.crd.ge.com/pub/tcl/tcl-www.tar.gz), and Woods Hole Oceanographic Institution's inside (ftp://acoustics.whoi.edu/pub/Matlab5/oceans/inside.m). Of those, we preferred Galacticomm Technologies' algorithm (Stein, 1997) for its simplicity, conciseness, and because it avoids division. Division is a programming nuisance because the denominator should always be checked against zero.
The algorithm counts the number of times a vector extending from the test point and parallel to the positive y-axis crosses an edge of the polygon. If the count is even or zero, the test point is outside the polygon. If the count is odd, the point is inside the polygon. For example, the vector V extending from point A crosses one edge of the polygon "sandy loam"; therefore, point A is inside the polygon (Fig. 1). The same vector crosses two edges of the polygon "sandy clay loam"; therefore, point A lies outside that polygon.
Figure 2
illustrates a simple case of how the algorithm works. Let ABCD be a polygon, T the test point, and V the vector extending from T parallel to the positive y-axis. First, the algorithm performs a "straddle test": Segment AD must straddle vector V. The test result is affirmative if the abscissa of T is greater than the abscissa of A and less than the abscissa of D. Second, the algorithm performs the "north test" to determine whether segment AD straddles the vector north of T. The test result is affirmative if the slope of segment TA is less than the slope of segment AD. If both the straddle test and the north test are affirmative, then the algorithm counts one successful crossing. The same procedure repeats for the other polygon edges. The algorithm starts assuming that the point is outside the polygon, and complements this assumption with each crossing. In this example there is only one crossing, so point T is inside polygon ABCD.
We modified Galacticomm Technologies' algorithm for the soil texture class determination. We translated it from C to Perl (for the World Wide Web version) and to Fortran (for the Windows console version). The algorithm was modified to work with real number vs. integer coordinates. We resolved the rare case of a point falling on the border between adjacent polygons. A point that falls on the border is assigned to all adjacent polygons. So, point B in Fig. 1 would be "loamclay loamsandy clay loam", and point C would be "silty clay loamclay loam".
The coordinates of all polygon vertices in the USDA triangle were coded into internal arrays within the program. The program reads the sand and clay content of a soil sample from a file. These are the x,y coordinates of the test point. The program iteratively evaluates the test point location, against the internal arrays containing the textural triangle polygon vertices, until the correct textural class polygon is determined. The textural class is then written to a file.
The program exists as an interactive World Wide Web application and as a Windows 95 console program. On a 133 MHz Pentium microcomputer the Windows version takes about a second to classify 1000 soil samples. To use the Windows version, the user must prepare an input file with two columns, in free format: the first column is sand percentage, the second is clay percentage. Sand and clay contents must be positive numbers. The output is a text file with the textural class for each sample.
 |
System Requirements and Availability
|
|---|
The interactive version of the classification program is on the World Wide Web at: http://nowlin.css.msu.edu/software/triangle_form.html. The Windows 95 console program and the source code are available at the same location or from the authors.
Received for publication July 24, 1998.
 |
REFERENCES
|
|---|
- Christopher T.B.S., Mokhtaruddin A.M. A computer program to determine the soil textural class in 123 for Windows and Excel. Commun. Soil Sci. Plant Anal. 1996;27:2315-2319.
- Gee G.W., Bauder J.W. Particle-size analysis. In: Klute A., ed. Methods of soil analysis. Part 1. 2nd ed. Agron. Monogr. 9. Madison, WI: ASA and SSSA, 1986:383-411.
- Gent J.A., Jr. A computer program for determining particle size distribution and soil textural class. Commun. Soil Sci. Plant Anal. 1983;14:347-351.
- Haralick R.M. A spatial data structure for geographic information systems. In: Freeman H., Pieroni G.G., eds. Map data processing. New York: Academic Press, 1980:63-99.
- Nordbeck S. Location of areal data for computer processing. Lund, Sweden: C.W.K. Gleerup Publ, 1962.
- Nordbeck S., Rystedt B. Computer cartography point-in-polygon programs. BIT 1967;7:39-64.
- Stein, B. 1997. A point about polygons. Linux J. March, p. 6772. Issue 35.
- van Rooyen F.C., Visser C.J. A digital computer program for particle size analysis and textural classification of soils. Commun. Soil Sci. Plant Anal. 1976;7:521-525.
This article has been cited by other articles:

|
 |

|
 |
 
C. J. Kucharik and K. R. Brye
Integrated BIosphere Simulator (IBIS) Yield and Nitrate Loss Predictions for Wisconsin Maize Receiving Varied Amounts of Nitrogen Fertilizer
J. Environ. Qual.,
January 1, 2003;
32(1):
247 - 268.
[Abstract]
[Full Text]
[PDF]
|
 |
|