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 in 10.8
- Supports the following new parameters.
- clipping to mask out layers outside of a clip polygon.
- spatialFilter to draw or query only features that meet the spatial filter criteria.
These parameters are only supported by map services published from ArcGIS Pro.
New in 10.6.1
- The operation supports the following new parameter:
- historicMoment—Queries from a given moment in an archive-enabled layer
New in 10.5
- The operation was enhanced with the following Boolean flags to support returning unformatted values and field names when desired:
- returnUnformattedValues
- returnFieldName
- The operation supports the following new parameters:
- datumTransformations—Provides a desired datum transformation to be applied while features get projected
- mapRangeValues—Sets values to ranges applicable to all layers with same ranges in the map service
- layerRangeValues—Sets range values specific layers
- layerParameterValuesSets value to parameterized filters to specific layers
- Simple syntax is not supported as an expected value for the layerDefs parameter starting at 10.5.
New in 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 if 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 in 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 |
---|---|
f |
Description: The response format. The default response format is html. Values: html | json |
geometry |
Description: (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 the 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:
The coordinates must always use a period as the decimal separator, even in countries where a comma is traditionally used. |
geometryType |
Description: 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 |
Description: 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 |
(New in 10.0) Description: 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: { "<layerId1>" : "<layerDef1>" , "<layerId2>" : "<layerDef2>" } Where layerId1, layerId2 are the layer IDs returned by the map service resource. Example: {"0":"POP2000 > 1000000","5":"AREA > 100000"} Note: Simple syntax is no longer supported starting at 10.5. |
time |
This parameter was added at 10.0. Description: The time instant or the time extent of the features to be identified. Time instant: Syntax: time=<timeInstant> Example: time=1199145600000 (1 Jan 2008 00:00:00 GMT) Time extent: 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. |
layerTimeOptions |
This parameter was added at 10.0. Description: 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 |
Description: The layers to perform the identify operation on. There are three ways to specify which layers to identify on:
Example: layers=all Default: By default, the identify operation identifies the topmost layer (that is, layers=top). 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 layers=visible:2,5, only layers with IDs 2 and 5, if visible, are identified. Syntax: [top | visible | all]:layerId1,layerId2 Where layerId1, layerId2 are the layer IDs returned by the map service resource. Example: layers=visible:2,5
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 |
Description: (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: tolerance=2 |
mapExtent |
Description: (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: <xmin>, <ymin>, <xmax>, <ymax> Example: mapExtent=-104,35.6,-94.32,41 |
imageDisplay |
Description: (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: <width>, <height>, <dpi> Example: imageDisplay=600,550,96 |
returnGeometry |
Description: If true, the result set will include the geometries associated with each result. The default is true. Values: true | false |
maxAllowableOffset |
This option was added at 10.0. Description: 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: maxAllowableOffset=2 |
geometryPrecision |
This option was added at 10.1. Description: 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: geometryPrecision=3 |
dynamicLayers |
This option was added at 10.1. Description: 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 the 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. Description: 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.
Note: This parameter only applies if returnGeometry=true. |
returnM |
This option was added at 10.1. Description: 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.
Note: This parameter only applies if returnGeometry=true. |
gdbVersion |
This option was added at 10.1. Description: Switch map layers to point to an alternate geodatabase version. Syntax: gdbVersion=<geodatabase version> Example: gdbVersion=sde.USER1 |
returnUnformattedValues | This option was added at 10.5. Description: 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. Note:
|
returnFieldName | This option was added at 10.5. Description: If true, field names will be returned instead of field aliases. Note:
|
datumTransformations | This option was added at 10.5. Description: 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 Geographic transformations. Syntax: datumTransformations=[wkid1, wkid2] Examples: datumTransformations=[1623, 4078] to apply multiple transformations Syntax: datumTransformations=[{<dt1>}, {<dt2>}] Examples: datumTransformations=[{"wkid":108889}, {"geoTransforms":[{"wkid":108889,"transformForward":true},{"wkid":1622,"transformForward":false}]}] to apply multiple transformations including a composite transformation For more information on datum transformation, see the transformation parameter in the Project operation. |
mapRangeValues | This option was added at 10.5. Description: 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. Syntax:
Example:
|
layerRangeValues | This option was added at 10.5. Description: 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. Syntax:
Example:
|
layerParameterValues | This option was added at 10.5. Description: 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. Description: 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, the identify will work with the current features. Syntax: historicMoment=<Epoch time in milliseconds> Example: historicMoment=1199145600000 |
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 i.e. feature layers, raster layers, TIN layers etc. Optionally you can use excludedLayers to excludes layers from being clipped. Note: geometry must be a polygon or an envelope. Syntax:
Example:
|
spatialFilter | This parameter was added at 10.8. It allows you to filter out features from all features layers based on the input spatial filter. It is like layerDefs but instead of using attribute filter, map service uses spatial filter to determine which features can be identified. Note:
Syntax:
Example:
|
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:
Example 2: Identify that includes geometry using a JSON structure. The response is in JSON format:
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:
Example 4: Identify operation using dynamicLayers:
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]]]} }]}