SSURGO Soil V2
POST SSURGO
Please note, you need to purchase a subscription key to call the API. Please use the trial version to try now for a limited amount of uses before purchase.
This API is utilized to drive the Ag-Analytics SSURGO soil panel below, for illustration. Area calculations from the API are provided in square meters and can be easily converted to acres on the front-end. The API Response contains shapes/features in ESRI JSON format, as well as the calculated metric (e.g., National Commodity Crop Productivity Index) and areas of each shape, the soil type name, the area for the sums of each soil type across all features for display in the table, metadata related to projection and other information. This API can be easily called and mapped using any standard front-end JavaScript mapping library (e.g., Leaflet).
Please note, this SSURGO Soil v2 API features changes in the response. Changes will be reflected in the Documentation and Jupyter Notebook.

SSURGO Soils in Ag-Analytics DataLayers.
Click the Jupyter Notebook Static Sample to view a static rendition of this APIs Jupyter Notebook.
Click the Jupyter Notebook Github Repo to access the Jupyter Notebook .ipynb files and
instructions needed in order to run this APIs Jupyter Notebook.
Request Parameters
Parameter | Data Type | Required? | Default | Options | Description |
---|---|---|---|---|---|
AOI | String | Yes (otherwise pass file) |
-- | Geojson or esriGeometryType |
If no spatial specification was provided, the result raster will use the Ag-Analytics default spatial reference: WGS 84, resolution at 0.0001 degree |
File | GeoTIFF or ShapeFile in a zip |
Yes (otherwise pass AOI) |
- | - | A GeoTiff (.TIFF,.Tif, .etc) or a Shapefile in Zip (must include shp, shx, dbf, but others files such as .prj, .xml, .cpg are recommended for better processing) |
Projection | String | No | "EPSG:4326" | ex:"EPSG:4326" | Output projection of result GeoTIFF. |
Resolution | String | No | "nccpi2all" | Full NRCS List | The soil metric to return, see the NRCS variables PDF for full list with descriptions |
Request Handling - Default Projections and Resolutions
AOI Type | Projection Specified? |
Resolution Specified? |
Ouput Projection | Output Resolution |
---|---|---|---|---|
Any | Yes | Yes | Request projection | Request resolution |
GeoTIFF | Yes | No | Request projection | GeoTIFF resolution |
GeoTIFF | No | Yes | GeoTIFF projection | Request resolution |
GeoTIFF | No | No | GeoTIFF projection | GeoTIFF resolution |
Shapefile | Yes | No | Request projection | Default resolution |
Shapefile | No | Yes | Shapefile projection | Request resolution |
Shapefile | No | No | Shapefile projection | Default resolution |
GeoJSON | Yes | No | Request projection | Default resolution |
GeoJSON | No | Yes | GeoJSON projection | Request resolution |
GeoJSON | No | No | GeoJSON projection | Default resolution |
Raster Response Parameters
Parameter | Type | Description |
---|---|---|
CellSize | List | Cell size/ Resolution of result raster |
CoordinateSystem | String | Coordinate System of result raster |
Extent | String | Corner coordinates of result raster |
Soil_Parameter | String | Soil metric/parameter |
Weighted_Average | Float | Weighted average soil matrix value |
pngb64 | String | Base 64 png string. |
Legend | List | Legend gives the following details for each range of values: 1. color: Hex color used for the crop type 2. Area: area of the Soil Type (see Soil_Type) covered in percentage 3. Count: Number of pixels from the result raster of a certain Soil_Type 4. CountAllPixels: Total number of pixels in the result raster 5. Soil_Type: Soil type in String 6. Value: Soil type in index, mukey value 7. Soil_Value: Value of requested soil matrix on current soil type |
GeoJSON Response Parameters
Parameter | Type | Description |
---|---|---|
GeoJSON | GeoJSON | Return the results as a FeatureCollection. The properties are also attached to each GeoJSON object. |
Soil_Parameter | String | Request soil matrix/parameter |
Weighted_Average | Float | Weighted average soil matrix/parameter by area |
Properties.SoilType | String | Soil type name in string |
Properties.area | Float | Area in acreage of current soil type |
Properties.mukey | Integer | Soil type key as integer |
Properties.Request SoilParameter |
Float | RequestSoilParameter will be based on the parameter in request. This parameter gives back the soil matrix/parameter value of current soil type. ex: Properties.nccpi2all |
Call API
Request
Request URL
Request headers
-
(optional)string
-
string
Request body
SSURGO Request Example.
AOI=%7B%22geometryType%22%3A+%22esriGeometryPolygon%22%2C+%22features%22%3A+%5B%7B%22geometry%22%3A+%7B%22rings%22%3A+%5B%5B%5B-85.179%2C+42.74%5D%2C+%5B-85.17858886748223%2C+42.74188232450973%5D%2C+%5B-85.17858886748223%2C+42.742675781062474%5D%2C+%5B-85.1782836915391%2C+42.742675781062474%5D%2C+%5B-85.1782226563505%2C+42.74230956993074%5D%2C+%5B-85.17529296909521%2C+42.74230956993074%5D%2C+%5B-85.17529296909521%2C+42.74353027370324%5D%2C+%5B-85.17529296909521%2C+42.74371337926908%5D%2C+%5B-85.17492675796348%2C+42.74389648393566%5D%2C+%5B-85.17437744126585%2C+42.744079589501496%5D%2C+%5B-85.17340087914721%2C+42.744079589501496%5D%2C+%5B-85.17327880876996%2C+42.74749755826576%5D%2C+%5B-85.17401123013411%2C+42.74749755826576%5D%2C+%5B-85.17401123013411%2C+42.74847412128372%5D%2C+%5B-85.17529296909521%2C+42.74847412128372%5D%2C+%5B-85.17590332008211%2C+42.74829101571788%5D%2C+%5B-85.17749023408697%2C+42.74792480458609%5D%2C+%5B-85.17761230446422%2C+42.7470703128447%5D%2C+%5B-85.1782836915391%2C+42.746704101712965%5D%2C+%5B-85.18072509728535%2C+42.746704101712965%5D%2C+%5B-85.179%2C+42.74%5D%5D%5D%2C+%22spatialReference%22%3A+%7B%22wkid%22%3A+4326%7D%7D%7D%5D%7D&Soil_Parameter=nccpi2all&Projection=EPSG%3A4326&Resolution=1e-05&Product=GeoJSON
Responses
200 OK
Code samples
@ECHO OFF
curl -v -X POST "https://ag-analytics.azure-api.net/ssurgo-v2/"
-H "Content-Type: application/x-www-form-urlencoded"
-H "Ocp-Apim-Subscription-Key: {subscription key}"
--data-ascii "{body}"
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;
namespace CSHttpClientSample
{
static class Program
{
static void Main()
{
MakeRequest();
Console.WriteLine("Hit ENTER to exit...");
Console.ReadLine();
}
static async void MakeRequest()
{
var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);
// Request headers
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");
var uri = "https://ag-analytics.azure-api.net/ssurgo-v2/?" + queryString;
HttpResponseMessage response;
// Request body
byte[] byteData = Encoding.UTF8.GetBytes("{body}");
using (var content = new ByteArrayContent(byteData))
{
content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >");
response = await client.PostAsync(uri, content);
}
}
}
}
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class JavaSample
{
public static void main(String[] args)
{
HttpClient httpclient = HttpClients.createDefault();
try
{
URIBuilder builder = new URIBuilder("https://ag-analytics.azure-api.net/ssurgo-v2/");
URI uri = builder.build();
HttpPost request = new HttpPost(uri);
request.setHeader("Content-Type", "application/x-www-form-urlencoded");
request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");
// Request body
StringEntity reqEntity = new StringEntity("{body}");
request.setEntity(reqEntity);
HttpResponse response = httpclient.execute(request);
HttpEntity entity = response.getEntity();
if (entity != null)
{
System.out.println(EntityUtils.toString(entity));
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function() {
var params = {
// Request parameters
};
$.ajax({
url: "https://ag-analytics.azure-api.net/ssurgo-v2/?" + $.param(params),
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
},
type: "POST",
// Request body
data: "{body}",
})
.done(function(data) {
alert("success");
})
.fail(function() {
alert("error");
});
});
</script>
</body>
</html>
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString* path = @"https://ag-analytics.azure-api.net/ssurgo-v2/";
NSArray* array = @[
// Request parameters
@"entities=true",
];
NSString* string = [array componentsJoinedByString:@"&"];
path = [path stringByAppendingFormat:@"?%@", string];
NSLog(@"%@", path);
NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
[_request setHTTPMethod:@"POST"];
// Request headers
[_request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
// Request body
[_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse *response = nil;
NSError *error = nil;
NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
if (nil != error)
{
NSLog(@"Error: %@", error);
}
else
{
NSError* error = nil;
NSMutableDictionary* json = nil;
NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
NSLog(@"%@", dataString);
if (nil != _connectionData)
{
json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
}
if (error || !json)
{
NSLog(@"Could not parse loaded json with error:%@", error);
}
NSLog(@"%@", json);
_connectionData = nil;
}
[pool drain];
return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';
$request = new Http_Request2('https://ag-analytics.azure-api.net/ssurgo-v2/');
$url = $request->getUrl();
$headers = array(
// Request headers
'Content-Type' => 'application/x-www-form-urlencoded',
'Ocp-Apim-Subscription-Key' => '{subscription key}',
);
$request->setHeader($headers);
$parameters = array(
// Request parameters
);
$url->setQueryVariables($parameters);
$request->setMethod(HTTP_Request2::METHOD_POST);
// Request body
$request->setBody("{body}");
try
{
$response = $request->send();
echo $response->getBody();
}
catch (HttpException $ex)
{
echo $ex;
}
?>
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers
'Content-Type': 'application/x-www-form-urlencoded',
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.urlencode({
})
try:
conn = httplib.HTTPSConnection('ag-analytics.azure-api.net')
conn.request("POST", "/ssurgo-v2/?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64
headers = {
# Request headers
'Content-Type': 'application/x-www-form-urlencoded',
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.parse.urlencode({
})
try:
conn = http.client.HTTPSConnection('ag-analytics.azure-api.net')
conn.request("POST", "/ssurgo-v2/?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
require 'net/http'
uri = URI('https://ag-analytics.azure-api.net/ssurgo-v2/')
request = Net::HTTP::Post.new(uri.request_uri)
# Request headers
request['Content-Type'] = 'application/x-www-form-urlencoded'
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
http.request(request)
end
puts response.body