FRAMES | NO FRAMES Description | Parameters | Examples | Response
Compute Histograms - Image Service (Operation)
URL http://<imageservice-url>/computehistograms
Parent Resource Image Service
Required Capability Image

Description

This operation is supported from 10.1 onwards.

The compute histograms 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 is an array of histograms for all raster bands computed from the given extent.

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

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.

Syntax: Examples:
  • 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 Specifies the mosaic rule defining the image sorting order. When mosaic rule is not specified, mosaic rule will default to what's specified in image service.

Syntax:
{
  "mosaicMethod" : "<esriMosaicNone | esriMosaicCenter | esriMosaicNadir | esriMosaicViewpoint | 
                     esriMosaicAttribute | esriMosaicLockRaster | esriMosaicNorthwest | esriMosaicSeamline>",
  "where" : "<where>",
  "sortField" : "<sortFieldName>",
  "sortValue" : <sortValue>,
  "ascending" : <true | false>,
  "lockRasterIds" : [<rasterId1>, <rasterId2>],
  "viewpoint" : <point>,
  "fids" : [<fid1>, <fid2>],
  "mosaicOperation" : "<MT_FIRST | MT_LAST | MT_MIN | MT_MAX | MT_MEAN | MT_BLEND>"
}
Example:
{
  "mosaicMethod" : "esriMosaicAttribute",
  "sortField" : "Category",
  "ascending" : false
}
renderingRule Specifies the rendering rule for how the requested image should be rendered.

Syntax:
{
  "rasterFunction" : "<rasterFunctionName>",
  "rasterFunctionArguments" : {<rasterFunctionArguments>},
  //optional parameter. For information on default 'variableNames', check the Raster Functions documentation for details. 
  "variableName" : "<variableName>"
}

The syntax of the rasterFunctionArguments property varies based on the specified rasterFunction name. Please refer to the Raster Functions documentation for more details.
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 simpler 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 1: Compute histograms of a mosaic dataset Image Service using a polygon geometry and specify mosaic rule using esriMosaicAttribute method.

http://myserver.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer/computeHistograms?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={"mosaicMethod" : "esriMosaicAttribute","where" : "Name NOT LIKE 'Ov%'","sortField" : "Name","mosaicOperation" : "MT_MAX"}&f=html

JSON Response Syntax

  "histograms" : [ 
    <histogram1>, <histogram2>
  ]

JSON Response Example

{
 "histograms": [
    {
      "size" : 256, 
      "min" : -0.5, 
      "max" : 255.5, 
      "counts" : [
        42915, 
        23218, 
        24832, 
        25925 
        36054, 
        57097, 
        61278, 
        65211
        ...
        ]
   },
   {
      "size" : 256, 
      "min" : -0.5, 
      "max" : 255.5, 
      "counts" : [
        42915, 
        23218, 
        24832, 
        25925 
        36054, 
        57097, 
        61278, 
        65211
        ...
        ]
   },
   {
      "size" : 256, 
      "min" : -0.5, 
      "max" : 255.5, 
      "counts" : [
        42915, 
        23218, 
        24832, 
        25925 
        36054, 
        57097, 
        61278, 
        65211
        ...
        ]
   }
}