Accessing Soil Survey Data via Web-Services

Submitted by dylan on Thu, 2009-05-28 17:46.

Soil Survey Data

Online 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
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 596

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="" xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="" xmlns:SOAP-ENC=""><SOAP-ENV:Body>
    <RunQuery xmlns="">
      <Query>SELECT * from component where mukey = '458913' ORDER BY comppct_r DESC;</Query>

Here is approximately how it is done in PHP:

// load NuSOAP library

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

//create client object
$query_url = '';

// SOAP server needs this
$soapaction = '';

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

// make the XML request by hand
$msg = $client->serializeEnvelope('
    <RunQuery xmlns="">
. $query . '</Query>
) ;

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

// extract the result

More Examples

  • MUKEY query by polygon:<Filter>
    <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>