Skip To Content
ArcGIS Developer
Dashboard

Compute Pixel Location

  • URL:https://<imageservice-url>/computePixelLocation
  • Required Capability:Image, Catalog
  • Version Introduced:10.7

Description

License:

As of 10.5, you must license your ArcGIS Server as an ArcGIS Image Server site to use this resource.

The computePixelLocation operation is performed on an image service resource that uses ArcObjects11 or ArcObjectsRasterRendering as the service provider. With given input geometries, it calculates the corresponding pixel location in columns and rows for an image based on input geometry. A prerequisite is that the raster catalog item has a valid icsToPixel resource. The result of this operation includes x- and y-values for the column and row of each input geometry. It can also include a z-value for the height at the given location if elevation information is associated with the catalog raster item.

At 10.8.1 and later, Catalog is no longer a required capability for this operation. Image services of georeferenced single raster datasets also support this operation. You can provide arguments to the computePixelLocation operation as query parameters defined in the parameters table below.

Request parameters

ParameterDetails
Geometries

(Required)

The array of geometries for computing pixel locations. The structure of each geometry in the array is the same as the structure of the JSON geometry objects. All geometries in this array should be of the type defined by geometryType.

rasterId

(Optional)

Specifies the objectId of the image service’s raster catalog. This integer rasterId number will determine which raster’s image coordinate system will be used during the calculation, and which raster the column and row results represent.

This parameter is only required if the image service is based on the raster catalog, and it must be left empty if it is not based on the raster catalog.

spatialReference

(Optional)

A JSON object that specifies the spatial reference of the Geometries parameter. This is an optional parameter, since a spatial reference can also be specified directly in each geometry object in the geometries array.

f

The response format. The default response format is html.

Values: html | json

Example usage

Below is a sample request URL that demonstrates how to compute the pixel location for the first raster catalog item of the image service for two points.

https://machine.domain.com:6443/webadaptor/rest/services/myAO11imageservice/ImageServer/ computePixelLocation?geometries={"geometries":  [{ "x": 491374.849829215906,"y": 3762865.05682404758,"spatialReference": {"wkid": 32611} }, {"x": 491483.5473642843,"y": 3763001.33978307154,"spatialReference": {"wkid": 32611}}],"geometryType":"esriGeometryPoint"}&rasterId=1&spatialReference=&f=pjson

JSON Response syntax


{
  "geometries": [
    {<geometry 1>},
    {<geometry n>}
  ]
}

JSON Response example


{
  "geometries": [
    {
      "x": -45.5617949605311878,
      "y": -31.7513701334796679,
      "z": 634.186505622650088
    },
    {
      "x": 5510.59714930129667,
      "y": 3674.28411545968675,
      "z": 633.867370170692766
    }
  ]
}