Identify (Map Service)
- URL:https://<mapservice-url>/identify
- Required Capability:Query
- Version Introduced:9.3
Description
The identify operation is performed on a map service resource to discover features at a geographic location. The result of this operation is an identify results resource. Each identified result includes its name, layer ID, layer name, geometry and geometry type, and other attributes of that result as name-value pairs.
New at 10.9
Supports the following new parameters. These parameters are only supported by map services published from ArcGIS Pro.
- timeRelationâControl whether you want to include or exclude start and end values specified in the time parameter.Note:
Check for supportsTimeRelation on a map service's root resource before using timeRelation.
New at 10.8
Supports the following new parameters. These parameters are only supported by map services published from ArcGIS Pro.
- clippingâMask out layers outside of a clip polygon.Note:
Check for supportsClipping, supportsSpatialFilter on a map service's root resource using clipping.
- spatialFilterâDraw or query only features that meet the spatial filter criteria.
New at 10.6.1
The operation supports the following new parameter:
- historicMomentâQueries from a given moment in an archive-enabled layer
New at 10.5
The operation was enhanced with the following Boolean flags to support returning unformatted values and field names:
- returnUnformattedValues
- returnFieldName
The operation supports the following new parameters:
- datumTransformationsâProvide a desired datum transformation to be applied while features are projected.
- mapRangeValuesâSet values to ranges applicable to all layers with same ranges in the map service.
- layerRangeValuesâSet range values specific layers.
- layerParameterValuesâSet values to parameterized filters to specific layers.
Simple syntax is not supported as an expected value for the layerDefs parameter starting at 10.5.
New at 10.1
- Support for dynamic layers was added with the dynamicLayers parameter. When using dynamicLayers, define definitionExpression and layerTimeOptions within dynamic layer definition. Use the layers property to specify whether only the top result or all results are to be returned in the identify result. Only those layers that are defined in dynamicLayers are used in the identify operation. The layer list in layers is ignored. Layer order is based on the order of dynamicLayer elements in the dynamicLayers array; the first dynamicLayer is on top of the second dynamicLayer.
- The gdbVersion parameter was introduced. Use this parameter to specify the geodatabase version.
- The geometryPrecision parameter was introduced. This option can be used to specify the number of decimal places in the response geometries returned by the identify operation.
- The returnZ and returnM parameters were introduced. If true, the parameters return z- and m-values, respectively.
- JSON response contains an optional property, exceededTransferLimit. This property will be true only if the number of records exceeds the maximum number configured by the server administrator.
- If map service resource lists hasLiveData as true, identify operations will default the value for the time parameter to be [<current server time - defaultTimeWindow>, <current server time>].
New at 10.0
Support for generalizing geometries returned by the identify operation was added. You can provide arguments to the identify operation as query parameters defined in the parameters table below.
Request parameters
Parameter |
Details |
---|---|
geometry
(Required) |
The geometry to identify on. The type of the geometry is specified by the geometryType parameter. The structure of the geometries is same as the structure of the JSON geometry objects returned by ArcGIS REST API. In addition to the JSON structures, for points and envelopes, you can specify the geometries with a simpler comma-separated syntax. Syntax
Examples
Note: The coordinates must always use a period as the decimal separator, even in countries where a comma is traditionally used. |
geometryType |
The type of geometry specified by the geometry parameter. The geometry type could be a point, line, polygon, or envelope. The default geometry type is a point (esriGeometryPoint). Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope |
sr |
The well-known ID of the spatial reference of the input and output geometries as well as the mapExtent. If sr is not specified, the geometry and the mapExtent are assumed to be in the spatial reference of the map, and the output geometries are also in the spatial reference of the map. |
layerDefs |
Allows you to filter the features of individual layers in the exported map by specifying definition expressions for those layers. A definition expression for a layer that is published with the service will be always honored. Syntax
Example
Note: Simple syntax is no longer supported starting at 10.5. |
time |
The time instant or the time extent of the features to be identified. Note: A null value specified for start time or end time will represent infinity for start or end time, respectively. Syntax
Examples
|
timeRelation (Time Relation) | Allows you to control whether to include or exclude features that are at the beginning or the end of a time window. The default value is esriTimeRelationOverlaps. Syntax
Example
|
layerTimeOptions |
The time options per layer. Users can indicate whether the layer should use the time extent specified by the time parameter, whether to draw the layer features cumulatively, and the time offsets for the layer. Syntax
Example
|
layers |
The layers to perform the identify operation on. The default value is top. There are three ways to specify which layers to identify on:
You can either specify the layer options as mentioned above by themselves or specify the layer option in conjunction with a list of layer IDs. When both the layer option and the layer IDs are specified, the server treats it as a Boolean AND operator. For example, if the parameter is specified as visible:2,5, only layers with IDs 2 and 5, if visible, are identified. Syntax
Examples
Note: In the case of dynamic layers, the layer list is ignored. It instead uses top or all (default) to identify the layers defined in the dynamicLayers parameter. |
tolerance
(Required) |
The distance in screen pixels from the specified geometry within which the identify operation should be performed. The value for the tolerance is an integer. Example
|
mapExtent
(Required) |
The extent or bounding box of the map currently being viewed. Unless the sr parameter has been specified, the mapExtent is assumed to be in the spatial reference of the map. The mapExtent and the imageDisplay parameters are used by the server to determine the layers visible in the current extent. They are also used to calculate the distance on the map to search based on the tolerance in screen pixels. Syntax
Example
|
imageDisplay (Required) |
The screen image display parameters (width, height, and DPI) of the map being currently viewed. The mapExtent and imageDisplay parameters are used by the server to determine the layers visible in the current extent. They are also used to calculate the distance on the map to search based on the tolerance in screen pixels. Syntax
Example
|
returnGeometry |
If true, the result set will include the geometries associated with each result. The default is true. Values: true | false |
maxAllowableOffset |
This option can be used to specify the maximum allowable offset to be used for generalizing geometries returned by the identify operation. The maxAllowableOffset is in the units of the sr. If sr is not specified, maxAllowableOffset is assumed to be in the unit of the spatial reference of the map. Example
|
geometryPrecision |
This option was added at 10.1. This option can be used to specify the number of decimal places in the response geometries returned by the identify operation. This applies to x- and y-values only (not m- or z-values). Example
|
dynamicLayers |
This option was added at 10.1. Use the dynamicLayers property to reorder layers and change the layer data source. The dynamicLayers property can also be used to add a new layer that was not defined in the map used to create the map service. The new layer should have its source pointing to one of the registered workspaces that was defined at the time the map service was created. The order of the dynamicLayers array defines the layer drawing order. The first element of dynamicLayers is stacked on top of all other layers. When defining a dynamic layer, source is required. Syntax
Example
|
returnZ |
This option was added at 10.1. If true, z-values will be included in the results if the features have z-values. Otherwise, z-values are not returned. The default is false. This parameter only applies if returnGeometry=true. Values: true | false |
returnM |
This option was added at 10.1. If true, m-values will be included in the results if the features have m-values. Otherwise, m-values are not returned. The default is false. This parameter only applies if returnGeometry=true. Values: true | false |
gdbVersion |
This option was added at 10.1. Switch map layers to point to an alternate geodatabase version. Syntax
Example
|
returnUnformattedValues | This option was added at 10.5. If true, the values in the result will not be formatted; in other words, numbers will be returned as is and dates will be returned as epoch values, and subtype and domain values are returned as numeric values instead of descriptions. The default value is false, formatting numbers and dates on the server's setting. Values: true | false |
returnFieldName | This option was added at 10.5. If true, field names will be returned instead of field aliases. The default value is false. In the case of layers with joins, fully qualified field names will be returned. Values: true | false |
datumTransformations | This option was added at 10.5. Use this parameter to apply one or more datum transformations to the map when sr is different than the map service's spatial reference. It is an array of transformation elements. Transformations specified here are used to project features from layers within a map service to sr. Note: While specifying transformation, you need to think about which datum transformation is best applicable to project a layer (not the map service) to the sr. The sourceSpatialReference property in a layer resource reports which spatial reference features are stored in the source dataset. For a list of valid datum transformation ID values and well-known text strings, see Using spatial references. For more information on datum transformation, see the transformation parameter in the Project operation. Syntax
Examples
|
mapRangeValues | This option was added at 10.5. It allows you to filter features in the exported map from all layers that are within the specified range instant or extent. Note: Check rangeInfos at the layer resources for the available ranges. Null, representing infinity, is allowed in value-ranges. For example, [null, 1500] means all features with values less than or equal to 1500 and [1000, null] means all features with values greater than or equal to 1000.
Example
|
layerRangeValues | This option was added at 10.5. It allows you to filter features for each individual layer that are within the specified range instant or extent. Note: Check rangeInfos at the layer resources for the available ranges. Null, representing infinity, is allowed in value-ranges. For example, [null, 1500] means all features with values less than or equal to 1500 and [1000, null] means all features with values greater than or equal to 1000. Syntax
Example
|
layerParameterValues | This option was added at 10.5. It allows you to filter the features of individual layers by specifying values to an array of preauthored parameterized filters for those layers. When a value is not specified for any parameter in a request, the default value that is assigned during authoring time is used instead. When a parameterInfo allows multiple values, you must pass them in an array. Note: Check parameterInfos at the layer resources for the available parameterized filters and their default values and expected data type. Syntax
Example
|
historicMoment | This option was added at 10.6.1. It specifies features from the historic moment to identify. This parameter applies only if the layer is archiving enabled and the supportsQueryWithHistoricMoment property is set to true. This property is provided in the layer resource. If historicMoment is not specified, identify will work with the current features. Syntax
Example
|
clipping | This parameter was added at 10.8. It allows you to mask out layers outside of the clip polygon in the exported map. Clipping can mask out any layer type, such as feature layers, raster layers, and TIN layers. Optionally, use excludedLayers to exclude layers from being clipped. Syntax
Example
|
spatialFilter | This parameter was added at 10.8. It allows you to filter out features from all feature layers based on the input spatial filter. It is similar to layerDefs, but instead of using an attribute filter, the map service uses a spatial filter to determine which features can be identified. Note: Spatial filters only work against feature layers. When both clipping and spatialFilter are provided, clipping takes precedence and spatialFilter is ignored. Syntax
Example
|
f |
The response format. The default response format is html. Values: html | json |
Example usage
Example 1: Identify that includes geometry using simple point syntax, tolerance, map extent, and image display. Default values for geometry type, spatial reference, layers, and returnGeometry are used. The response is in HTML format:
https://machine.domain.com/arcgis/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/identify?geometryType=esriGeometryPoint&geometry=-120,40&tolerance=10&mapExtent=-119,38,-121,41&imageDisplay=400,300,96
Example 2: Identify that includes geometry using a JSON structure. The response is in JSON format:
https://machine.domain.com/arcgis/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/identify?geometryType=esriGeometryPoint&geometry={x: -120, y:40}&tolerance=10&mapExtent=-119,38,-121,41&imageDisplay=400,300,96&f=json
Example 3: Identify that specifies a specific layer. In this example, only layer 2 is desired. Since this is not the top layer, the syntax layer=all:2 is used:
https://machine.domain.com/arcgis/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/identify?geometryType=esriGeometryPoint&geometry={x: -120, y:40}&layers=all:2&tolerance=10&mapExtent=-119,38,-121,41&imageDisplay=400,300,96&returnGeometry=true
Example 4: Identify operation using dynamicLayers:
https://machine.domain.com/arcgis/rest/services/Census/MapServer/identify?geometry={"rings":[[[-406686.615,151348.621],[-277679.963,210564.789],[-152903.038,82615.569],[-334781.268,46662.895],[-406686.615,151348.621]]],"spatialReference":{"wkid":102003}}&geometryType=esriGeometryPolygon&sr=102003&layers=all&layerDefs=&time=&layerTimeOptions=&tolerance=2&mapExtent=-574325.931693231,-211967.870311805,154917.862982949,393469.077966946&imageDisplay=1056,816,96&returnGeometry=true&maxAllowableOffset=&dynamicLayers=[{"id":101,"source":{"type":"mapLayer","mapLayerId":3}}]&returnZ=false&returnM=false&gdbVersion=&f=pjson
JSON Response syntax
{
"results": [
{
"layerId": <layerId1>,
"layerName": "<layerName1>",
"value": "<value1>",
"displayFieldName": "<displayFieldName1>",
"attributes": {
"<fieldName11>": <fieldValue11>,
"<fieldName12>": <fieldValue12>
},
"geometryType": "<geometryType1>",
"hasZ": <true|false>, //added in 10.1
"hasM": <true|false>, //added in 10.1
"geometry": {<geometry1>}
},
{
"layerId": <layerId2>,
"layerName": "<layerName2>",
"value": "<value2>",
"displayFieldName": "<displayFieldName1>",
"attributes": {
"<fieldName21>": <fieldValue21>,
"<fieldName22>": <fieldValue22>
},
"geometryType": "<geometryType2>",
"hasZ": <true|false>, //added in 10.1
"hasM": <true|false>, //added in 10.1
"geometry" : {<geometry2>}
}
]
}
JSON Response example
{
"results": [
{
"layerId": 3,
"layerName": "Cities",
"value": "Joe City",
"displayFieldName": "City Name",
"attributes": {
"City Name": "Joe City",
"CLASS": "city",
"ST": "CA"
},
"geometryType": "esriGeometryPoint",
"geometry": {
"x": -118.375,
"y": 34.086,
"spatialReference": {
"wkid": 4326
}
}
},
{
"layerId": 59,
"layerName": "Parcel",
"value": "Parcel 649",
"displayFieldName": "NAME",
"attributes": {
"NAME": "Parcel 649",
"SUB_REGION": "Pacific",
"STATE_ABBR": "CA"
},
"geometryType": "esriGeometryPolygon",
"geometry": {
"spatialReference": {
"wkid": 4326
},
"rings": [
[
[-118.35,32.81],
[-118.42.806],
[-118.511,32.892],
[-118.35,32.81]
]
]
}
}
]
}