Compute Statistics and Histograms

Description

This operation is supported at 10.4 and later.

The computeStatisticsHistograms operation is performed on an image service resource.

This operation is supported by any image service published with mosaic datasets or a raster dataset.

The result of this operation contains both statistics and histograms computed from the given extent.

You can provide arguments to the computeStatisticsHistograms operation as query parameters defined in the following parameters table:

Request parameters

Parameter

Details

f

Description: The response format. The default response format is html.

Values: html | json

geometry

(Required)

Description: A geometry that defines the geometry within which the histogram is computed. The geometry can be an envelope or a polygon. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.

JSON structures:

Syntax: geometry={geometry}

Example: geometry={"xmin" : -109.55, "ymin" : 25.76, "xmax" : -86.39, "ymax" : 49.94, "spatialReference" : {"wkid" : 4326}}

geometryType

(Required)

Description: The type of geometry specified by the geometry parameter. The geometry type can be an envelope or polygon.

Values: esriGeometryEnvelope | esriGeometryPolygon

mosaicRule

Description: Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image service will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue).

See the mosaic rule JSON objects for the syntax and examples.

renderingRule

Description: Specifies the rendering rule for how the requested image should be rendered.

See raster function JSON objects for the syntax and examples.

pixelSize

Description: The pixel level being used (or the resolution being looked at). If pixel size is not specified, then pixelSize will default to the base resolution of the dataset. The raster at the specified pixel size in the mosaic dataset will be used for histogram calculation.

The structure of the pixelSize parameter is the same as the structure of the point object returned by the ArcGIS REST API. In addition to the JSON structure, you can specify the pixel size with a simple comma-separated syntax.

Syntax:

  • JSON structure: pixelSize={point}
  • Point simple syntax: pixelSize=<x>,<y>

Examples:

  • pixelSize={"x": 0.18, "y": 0.18}
  • pixelSize=0.18,0.18

Example usage

Example: Compute statistics and histograms of a mosaic dataset image service using a polygon geometry, and specify the mosaic rule using the esriMosaicAttribute method.

http://myserver:.6080/arcgis/rest/services/myservice/ImageServer/computeStatisticsHistograms?geometry={"rings": [[[-13555360.4191,5911556.581],[-13489311.5669, 5898227.932],[-13423477.4153,5884426.3329],[-13602646.9571, 5717848.4135], [-13587119.9125, 5781976.6214],[-13571360.1713, 5846543.2654],[-13555360.4191, 5911556.581]]]}&geometryType=esriGeometryPolygon &mosaicRule=&f=html

JSON response syntax

{
													"statistics": [<statistics1>, <statistics2>],
													"histograms": [<histogram1>, <histogram2>]	
													}

JSON response example

{
	"statistics": [
				{
						"min": 10,
						"max": 250,
						"mean": 41.249343750000001,
						"standardDeviation": 59.864355482423292,
						"count": 160000,
						"median": 17,
						"mode": 13	},
				{		
						"min": 10,
						"max": 250,
						"mean": 41.257618749999999,
						"standardDeviation": 59.842143766690171,
						"count": 160000,
						"median": 17,
						"mode": 16	},
				{		
						"min": 10,
						"max": 250,
						"mean": 67.500718750000004,
						"standardDeviation": 76.023263357915454,
						"count": 160000,
						"median": 50,
						"mode": 18	}],

					 "histograms": [
    
				{
      "size" : 251, 
      "min" : -0.5, 
      "max" : 250.5, 
      "counts" : [
        ...
								10820, 
        10722, 
        10961, 
        ...
        ]
   },
   {
      "size" : 251, 
      "min" : -0.5, 
      "max" : 250.5, 
      "counts" : [
         ...
								10421, 
        16762, 
        17961, 
        ...
        ]
   },
   {
      "size" : 251, 
      "min" : -0.5, 
      "max" : 250.5, 
      "counts" : [
         ...
								12321, 
        13662, 
        15961, 
        ...
        ]
   }
}

9/13/2017