Identify (Map Service)
- URL:http:// <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.1
- Support for dynamic layers was added with the dynamicLayers parameter. When using dynamicLayers, define definitionExpression and layerTimeOptions within dynamic layer definition. Use 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.
- gdbVersion parameter was introduced. Use this parameter to specify the geodatabase version.
- 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.
- returnZ and returnMreturnM parameters were introduced. If true, returns 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 to be true, identify operations will default the value for 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 an 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. Definition expression for a layer that is published with the service will be always honored. Simple Syntax: 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 JSON Syntax: You can also use JSON representation for Layer Defintions. 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"} |
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 or not the layer should use the time extent specified by the time parameter or not, whether to draw the layer features cumulatively or not 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 top-most 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 as well as 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 dynamicLayers parameter. |
tolerance |
Description: (Required) The distance in screen pixels from the specified geometry within which the identify 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 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: <width>, <height>, <dpi> Example: imageDisplay=600,550,96 |
returnGeometry |
Description: If true, the resultset 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 dynamicLayers property to reorder layers and change the layer data source. dynamicLayers can also be used to add 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 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 |
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]]]} }]}