ge_thumbnail.pngOnline Querying of NRCS Soil Survey Data
Sometimes you are only interested in soils data for a single map unit, component, or horizon. In these cases downloading the entire survey from Soil Data Mart is not worth the effort. An online query mechanism would suffice. The NRCS provides a form-based, interactive querying mechanism and a SOAP-based analogue. These services allow soil data lookup from the current snapshot of all data stored in NASIS.

An Example Implementation
A simple front-end to the SDM-SOAP query mechanism was implemented using the NuSOAP PHP library. We plan to integrate this functionality into our online soil survey in the near future. Although the documentation on how to craft a working SOAP query is very limited, you can get a response by creating a message like this:

POST /Tabular/SDMTabularService.asmx HTTP/1.0
Host: SDMDataAccess.nrcs.usda.gov
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: "http://SDMDataAccess.nrcs.usda.gov/Tabular/SDMTabularService.asmx/RunQuery"
Content-Length: 596

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>
    <RunQuery xmlns="http://SDMDataAccess.nrcs.usda.gov/Tabular/SDMTabularService.asmx">
      <Query>SELECT * from component where mukey = '458913' ORDER BY comppct_r DESC;</Query>
    </RunQuery>
</SOAP-ENV:Body></SOAP-ENV:Envelope>

Here is approximately how it is done in PHP:

// load NuSOAP library
require_once('nusoap.php');

// query template:
$query = 'SELECT ... etc.';

//create client object
$query_url = 'http://SDMDataAccess.nrcs.usda.gov/Tabular/SDMTabularService.asmx';

// SOAP server needs this
$soapaction = 'http://SDMDataAccess.nrcs.usda.gov/Tabular/SDMTabularService.asmx/RunQuery';

// open a new client
$client = new soapclient($query_url);

// make the XML request by hand
$msg = $client->serializeEnvelope('
    <RunQuery xmlns="http://SDMDataAccess.nrcs.usda.gov/Tabular/SDMTabularService.asmx">
      <Query>' . $query . '</Query>
    </RunQuery>
') ;

// send the request
$result = $client->send($msg, $soapaction);

// extract the result
print_r($result['RunQueryResult']['diffgram']['NewDataSet']['Table']);

More Examples

MUKEY query by polygon:

http://sdmdataaccess.nrcs.usda.gov/Spatial/SDMNAD83Geographic.wfs?Service=WFS&Version=1.0.0&Request=GetFeature&OutputFormat=XmlMukeyList&Typename=MapunitPolyNoGeometry&FILTER=<Filter>
<Intersect>
<PropertyName>Geometry</PropertyName>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>-118.908508862,38.8086306467 -118.919673024,38.7901219483 -118.874871427,38.7756131355 -118.862298961,38.7924133734 -118.902681975,38.806449763 -118.908508862,38.8086306467</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</Intersect>
</Filter>

Links:

SoilWeb: An Online Soil Survey Browser

Initial SoilWeb Concept on Paper