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
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']);

 
The SoilWeb API
Our online soil survey (SoilWeb) has several URL-based query mechanisms for USDA-NRCS soil survey data in CA, AZ, and NV. These are essentially short-cuts to a snapshot of the official data, provided by our local server. A full listing of the available query mechanisms will be posted soon. The Google Maps and Google Earth interfaces to SoilWeb are built upon some soon-to-be-published components of the SoilWeb API. Examples below:

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <div> <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.