Elevation Index
Elevation Index POST Request - Prepare TIFF
The Elevation Index API offers a means of computing four elevation indices for an elevation raster that is passed to the service. The four indices are relative elevation, slope, topographic position index (TPI), and terrain ruggedness index (TRI). When using the API, the client can specify the particular indices that should be calculated for the elevation raster and there are options for a few tuning parameters relating to TPI and TRI.
The intent behind the service is to provide farmers and producers with the ability to extract more information about the elevation of their field and the relationship with parameters such as wetness and yield. The correlation between these indices and yield is most often due to the way water is transported across sections of a farm field (i.e., correlation with chronically dry and wet areas).
POST Request Example of Relative Elevation.
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 |
---|---|---|---|---|---|
Shape | geojson | Yes | -- | geojson |
Geojson area of interest to return |
index_list | List of indices as a string |
Yes | -- | "Relative_Elevation" "Slope" "TPI" "TRI" |
Indices that should be calculated for the input geojson |
Inside_Radius | Integer as string | No | 3 | 0<Outside_Radius<20 | Outer radius of window for computing TPI |
Outside_Radius | Integer as string | No | 1 | 0<=Inside_Radius <Outside_Radius |
Inner radius of window for computing TPI |
Search_Radius | Integer as string | No | 1 | 0 < Search_Radius | Radius of window for computing TRI |
Legend_Range | Integer as string | No | 3 | 0 < Legend_Range | Number of ranges to display in png of output image |
Response Parameters
Parameter | Data Type | Required? |
---|---|---|
Features |
List |
Container for all of the features of the DEM raster. |
Features.attributes (F.a) |
Dictionary |
Each feature in Features has an associated attributes dictionary. |
F.a.CellSize |
List |
Resolution as x,y cell size. In units of projection. |
F.a.CoordinateSystem |
String |
Projection in WKT |
F.a.Extent |
String |
Extent of result geotiff. |
F.a.Legend (F.a.L) |
List |
Each range in the output PNG is represented by a separate dictionary. |
F.a.L.Area |
String |
Percent of total image that the particular range of values covers. |
F.a.L.Count |
Int |
Number of pixels that a particular range takes up in the png. |
F.a.L.CountAllPixels |
Int |
Total number of pixels in the png image. |
F.a.L.Max |
Float |
Maximum value in the range. |
F.a.L.Mean |
Float |
Mean value of the range. |
F.a.L.Min |
Float |
Min value of the range. |
F.a.L.color |
String |
Hex value that is used to display the png image. |
F.a.Matrix |
List |
Dimensions of output image. |
F.a.Max |
Float |
Maximum value of entire raster. |
F.a.Mean |
Float |
Mean value of entire raster. |
F.a.Min |
Float |
Min value of entire raster. |
F.a.OID |
Int |
Deprecated |
F.a.Percentile5 |
Float |
5th percentile value. |
F.a.Percentile95 |
Float |
95th percentile value. |
F.a.Std |
Float |
Standard deviation of raster values. |
F.a.Variet |
String |
Either Variety or NoVariety. Flag for category or continuous data. |
F.a.pngb64 |
String |
The png image returned in base64 encoding. |
FileName |
String |
Name of result raster that was generated in POST request. Used in GET request to retrieve GeoTiff file. |
Index_Files |
List |
List of elevation index files that can be used in GET request to return the GeoTiffs. |
Call API
Request
Request URL
Request headers
-
(optional)string
Request body
{
"Inside_Radius": "3",
"Legend_Range": "10",
"Outside_Radius": "5",
"Search_Radius": "2",
"Shape": "{\"type\":\"Feature\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-76.5907145, 42.443918], [-76.5898132, 42.4224745], [-76.5699863, 42.4230447], [-76.5710592, 42.4443296], [-76.5907145, 42.443918]]]},\"properties\":{\"OBJECTID\":4944402,\"CALCACRES\":46.15999985,\"CALCACRES2\":null},\"id\":4944402}",
"index_list": "['Relative_Elevation']"
}
Responses
200 OK
Success Example
Representations
{"Slope": "raster_Slope_60326.tif", "features": [[{"attributes": {"CellSize": [9.259259269220297e-05, -9.259259269220297e-05], "CoordinateSystem": "GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]]", "Extent": "-76.4984894, 42.44091207776192, -76.47552643701233, 42.455634299999986", "Legend": [{"Area": "33.33 %", "Count": 12550, "CountAllPixels": 37649, "Max": 0.0182556863874197, "Mean": 0.009127915863693659, "Min": 1.4533996761656454e-07, "color": "#4d76d5"}, {"Area": "33.33 %", "Count": 12549, "CountAllPixels": 37649, "Max": 0.0475408136844635, "Mean": 0.0328982500359416, "Min": 0.0182556863874197, "color": "#e5cc78"}, {"Area": "33.33 %", "Count": 12550, "CountAllPixels": 37649, "Max": 0.8181570172309875, "Mean": 0.4328489154577255, "Min": 0.0475408136844635, "color": "#e9e9e9"}], "Matrix": [159, 248], "Max": 0.8181570172309875, "Mean": 0.05745059624314308, "Min": 1.4533996761656454e-07, "OID": 0, "Percentile5": 0.0029396485537290574, "Percentile95": 0.21061243116855616, "Product": "Slope", "Std": 0.08429117575830632, "Variety": "NoVariety", "pngb64": "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAPgAAACfCAYAAADUIBTpAAAZnUlEQVR4nO1dO45ct9IuX8wSJCgwZgVOvQ2nypwpcCoIMO4SDAGCUgXKnDnVNm7qFQh/YFhLUPAHY1qcmnpX8dXdHzCw1d2H5OHhxyrW63z3069//g0L8OHl74/+/csfPz/57u7+9ZPrXrx48XzsyG644XLwn1Ud94QGeCA1Jv3Xz++fXPfXX38t2ZBuuOFEfLdKgmN8ePn7EylOSXAv2ibhbavfXNq4+g2Iai/aV38t3vh64A1QGksG/b1//+NvN43pYCwneFu0PYmqF6wXErktY/v6+X0ZyTlSY1TOGaU5WUFtUPgZ489Ho80NdV/ShiqBu6dMWyM20+UEbxhB7CjRKvoFyElyL3YguHexjyC4NA+VBK9GL0D6jZ6aI2kTxb/bguCV6vhq6Z+BhVgz7g+PgzqiUIiQxWJstUCbl6+f35Nt70JwAJ6k0Y1wOcEvSWpnsQO5JQlnWWSjyGLpm5sbbrPaEdx9Rkn+yx8/w112UFFYyC2RlVOD+/NWtdpqbU/7Lf4en72ph7lq05p1TpZgWeCv3n0hP//w8rHa+/CZTe2dDe4+M89gmQTXLNIWaGfd7Fk4M65Vm0tFXz1wv9pmNJIofV+Wf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xOB79FjI2rYQoJbcmYtQQceHzDVj8dg5hlbpn+qPyus9gJL/xwsUjyyMHtQz4Az/GU0u520Ag+xsWX9mEi2ih3auni9C6xSevREzJANt4nbbu1770WyonOqev+5xf2jbZj4e8o+8OHl7655e3rs2Csc1ktsso3SEQVQGS5JfeZZWD36BTPjgVv99QDzF6A1kIW6rsEzfs0nrGkl0diDb9d9MWmVFLgNpurYRvUj2UOWE3wErIYaK1ac9SjDHreJte+5dqLoSV1pNddIIEXpUeSuiNrD4NaQRdvBwJqFtpFHjhmcMXTpGbzioeCFT0UtAdgXVdYVJKma1rFIwAsg4j66dOMUQG0EoVYtONLOiDiOhq0CXbIk9xLY8n1GA8hGJFlUM0vwjfQ5N4ZKwyGHbJRfQ2YjzpKz6v3oo7AlwT3JCpWLb0SbfbscGvm8lnOrTcBrO6A0gZERehljGAcreSJvN8m24W2f6st6fz3Bl5/Bd3vtURWscc0jNhjOgi6hbTY90aukbd9HBNiIxElT61lcMkqteB3XpXLghhtuuOGGG26I4v8BpuvJ6T5M710AAAAASUVORK5CYII="}}]]}
Code samples
@ECHO OFF
curl -v -X POST "https://ag-analytics.azure-api.net/elevation-index/"
-H "Content-Type: application/json"
--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
var uri = "https://ag-analytics.azure-api.net/elevation-index/?" + 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/elevation-index/");
URI uri = builder.build();
HttpPost request = new HttpPost(uri);
request.setHeader("Content-Type", "application/json");
// 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/elevation-index/?" + $.param(params),
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Content-Type","application/json");
},
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/elevation-index/";
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/json" forHTTPHeaderField:@"Content-Type"];
// 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/elevation-index/');
$url = $request->getUrl();
$headers = array(
// Request headers
'Content-Type' => 'application/json',
);
$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/json',
}
params = urllib.urlencode({
})
try:
conn = httplib.HTTPSConnection('ag-analytics.azure-api.net')
conn.request("POST", "/elevation-index/?%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/json',
}
params = urllib.parse.urlencode({
})
try:
conn = http.client.HTTPSConnection('ag-analytics.azure-api.net')
conn.request("POST", "/elevation-index/?%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/elevation-index/')
request = Net::HTTP::Post.new(uri.request_uri)
# Request headers
request['Content-Type'] = 'application/json'
# 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