Compute Statistics and Histograms

URL:
https://<imageservice-url>/computeStatisticsHistograms
Methods:
GET
Required Capability:
Image
Version Introduced:
10.4

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 an 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.

Support for the time parameter is added at 10.8. The time` parameter can be used on an image service resource that uses ArcObjects11 or ArcObjectsRasterRendering as the service provider.

Support for the processAsMultidimensional parameter is added at 10.9. The processAsMultidimensional parameter can be used on an image service resource that uses ArcObjects11 or ArcObjectsRasterRendering as the service provider.

You can provide arguments to the computeStatisticsHistograms operation as query parameters defined in the parameters table below.

Request parameters

ParameterDescription

geometry

(Required)

Defines the geometry in 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)

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

Values: esriGeometryEnvelope | esriGeometryPolygon

mosaicRule

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 specified in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue).

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

renderingRule

Specifies the rendering rule for how the requested image will be rendered.

See raster function JSON objects for the syntax and examples.

pixelSize

The pixel level being used (or the resolution being looked at). If pixel size is not specified, 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

time

The time instant or the time extent to compute statistics and histograms. Time is designated in UNIX epoch time or POSIX time in milliseconds.

Time instant:

  • Syntax: time=<timeInstant>
  • Example: time=1199145600000 (1 Jan 2008 00:00:00 GMT)

Time extent (for time extents, one of <startTime> or <endTime> can be 'null' ):

  • Syntax: time=<startTime>, <endTime>

  • Example: time=1199145600000, 1230768000000 (1 Jan 2008 00:00:00 GMT to 1 Jan 2009 00:00:00 GMT)

    A null value specified for start time or end time will represent infinity for start or end time, respectively.

processAsMultidimensional

Specifies whether to process the image service as a multidimensional image service. When set to true , the image service will be treated as a multidimensional raster and it will compute histograms and statistics of pixel values from all selected slices. The default is false .

Syntax: processAsMultidimensional=<true|false>

Example: processAsMultidimensional=true

f

The response format. The default response format is html .

Values: html | json

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.

https://webadaptorhost.domain.com/webadaptorname/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

Use dark colors for code blocksCopy
1
2
3
4
{
													"statistics": [<statistics1>, <statistics2>],
													"histograms": [<histogram1>, <histogram2>]
													}

JSON Response example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
 "statistics": [
  {
   "min": 10,
   "max": 250,
   "mean": 45.623781249999745,
   "standardDeviation": 63.183071536848246,
   "median": 17,
   "mode": 13,
   "skipX": 1,
   "skipY": 1,
   "count": 160000,
   "sum": 7299804.999999959
  },
  {
   "min": 10,
   "max": 250,
   "mean": 76.2679624999998,
   "standardDeviation": 78.07187772310637,
   "median": 20,
   "mode": 16,
   "skipX": 1,
   "skipY": 1,
   "count": 160000,
   "sum": 1.2202873999999968E7
  },
  {
   "min": 10,
   "max": 250,
   "mean": 45.623706249999785,
   "standardDeviation": 63.16672024871653,
   "median": 17,
   "mode": 13,
   "skipX": 1,
   "skipY": 1,
   "count": 160000,
   "sum": 7299792.999999966
  }
 ],
 "histograms": [
  {
   "size": 251,
   "min": -0.5,
   "max": 250.5,
   "counts": [
    ……
    906,
    861,
    915,
    899,
    ……
   ]
  },
  {
   "size": 251,
   "min": -0.5,
   "max": 250.5,
   "counts": [
    ……
    1801,
    1776,
    1779,
    1814,
    ……
   ]
  },
  {
   "size": 251,
   "min": -0.5,
   "max": 250.5,
   "counts": [
    ……
    902,
    931,
    912,
    877,
    ……
   ]
  }
 ]
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.