ArcGIS REST API

Compute Pixel Location

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

Description

License:

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

This operation is supported at 10.7 and later.

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 corresponding pixel location in column and row on a specific raster catalog item.

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 also includes a z-value for the height at the given location based on elevation information associated with the catalog raster item.

If itemIds is specified, uploaded rasters are copied to the image service's dynamic image workspace location. If serviceUrl is specified, the image service adds the URL to the mosaic dataset, and no raster files are copied. The serviceUrl is required input for the following raster types: Image Service, Map Service, WCS, and WMS.

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

Request parameters

ParameterDetails
f

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

Values: html | json

Geometries

(Required)

Description: 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

(Required)

Description: 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.

spatialReference

Description: 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.

Example usage

Compute the pixel location for the first raster catalog item of the image service for two points.

https://myserver:6443/arcgis/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
  }