class dijits.identify.Identify

dojo.require("dijits.identify.Identify");
defined in dijits/identify/Identify.js

This dijit lets the users identify features on the map. The identify operation is performed when the users click on the map. A list of features will be displayed upon completion of the identify operation. When the users move the cursor over a feature, a focus link will be displayed and the corresponding feature will be highlighted on the map. Clicking the focus link will zoom the map to the corresponding feature. The users can also click a feature in the list to get information about the attribute fields and values associated with the feature.

By default, the dijit is attached to the map like an info-window. But it can also be detached and moved anywhere within the page so that the map area is uncluttered. It has an options panel that lets the users change settings such as the map services on which the identify operation is performed and the tolerance.

Class hierarchy

             +------------------------------+
             ¦            Object            ¦
             +------------------------------+
                  Δ                   Δ
                  |                   | 
                  |                   |
         +----------------+  +--------------------+
         ¦  dijit._Widget ¦  ¦  dijit._Templated  ¦
         +----------------+  +--------------------+
                  Δ                   Δ
                  |                   | 
                  |                   |
             +------------------------------+
             ¦   dijits.identify.Identify   ¦
             +------------------------------+

Constructor

new dijits.identify.Identify( params, srcNodeRef? )
Creates a new identify dijit using the given DOM node.

Parameters:

Name Type Description
params Object Various parameters to configure this dijit. See the list below for details.
srcNodeRef DOMNode | String Optional. Reference or id of a HTML element that this dijit is rendered into. The HTML element will be replaced by the dijit.


The following parameters are supported:

Name Type Description
map Map Map object that this dijit is associated with. This parameter is always required.
label String Optional. A name/label for the dijit, to be displayed on the title bar. Default is "Identify".
mapServices Object[] Optional. Specifies the map services on which to perform the identify operation. In the absence of this option, the list of map services is obtained directly from the map object at the time of creation of this dijit. It is an array of object literals with the following properties:

Name Type Description
url String URL to the ArcGIS Server REST resource that represents a map service.
name String Optional. This value is used when displaying the list of map services in the options panel of the dijit.
layerIds Number[] Optional. The layers to perform the identify operation on. When both the layerIds and layerOption properties are specified, the server processes them with a boolean "AND" operator. See layerOption property for more ways to specify the layers.
layerOption String Optional. The layers to perform the identify operation on. See the Constants table for valid values. Default value is esri.tasks.IdentifyParameters.LAYER_OPTION_TOP
displayOptions Object Optional. It is an object literal that contains a property for each layer that you want to customize. You need to specify the layer id as the name of the property whose value is an object literal with the following optional properties:

displayFieldName - Name of an attribute field, the value of which will be used to represent an identified feature (like a title). A list of such attribute fields can be found in the layer resource page for each layer in a map service. By default, a layer's default display field is used for this purpose.

layerAlias - This option is used to specify user-friendly name for a layer. In the absence of this option, layerName returned in the result of the identify operation will be used.

attributes - A list of attribute fields to be displayed when the user selects an identified feature.

fieldAliases - Alias names for certain attributes specified as a set of name-value pairs where name represents an attribute field and the value represents the corresponding alias.

See an example below.

Example:

[
 {
   url: "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/Portland_ESRI_LandBase_AGO/MapServer/",

   name: "Portland Landbase",

   layerOption: esri.tasks.IdentifyParameters.LAYER_OPTION_ALL,

   displayOptions: {
     "2" : {
       displayFieldName : "TLID",
       layerAlias: "Tax lot",
       attributes: [ "TLID", "RNO" ],
       fieldAliases: { "TLID": "Tax Lot ID" }
     }
   }
 }
]
id String Optional. Unique identifier for this dijit.
defaultTolerance Number Optional. The distance in screen pixels from the selected location within which to perform the identify operation. Default value is 1 pixel. Maximum allowed value is 5 pixels.
fillSymbol FillSymbol Optional. Symbol used to draw polygon features.
lineSymbol LineSymbol Optional. Symbol used to draw polyline features.
markerSymbol MarkerSymbol Optional. Symbol used to draw point features.
locationMarker MarkerSymbol Optional. Symbol used to represent the location where the user clicked on the map.


Methods

Methods Return Value Description
startup() none Finalizes the creation of this dijit. This method should be called after the constructor for this dijit is called and before letting the users interact with it.
getInfoWindowConnector() InfoWindowConnector Returns a reference to the connector that manages this dijit like an info-window.
destroy() none Releases all resources used by the dijit. This method should be called when an instance of this dijit is no longer needed in your application.


Usage

Create the dijit with default parameters

 var identifyDijit = new dijits.identify.Identify({ map: map });
 identifyDijit.startup();

When the dijit is created in this fashion, the identify operation will be performed on all map service layers added to the map. However, the users will be able to select the map services from the "options" panel in the dijit.

Create the dijit with custom parameters

 var identifyDijit = new dijits.identify.Identify({ 
   map: map,
   defaultTolerance: 2,
   mapServices: [
     {
       url: "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/Portland_ESRI_LandBase_AGO/MapServer/",
       name: "Portland Landbase",
       displayOptions: {
         "2": { layerAlias: "Tax lot", attributes: [ "TLID", "RNO" ] },
         "3": { displayFieldName: "BUILD_ID" },
         "4": { displayFieldName: "ZONEGEN_CL" }
       }
     }
   ],
   fillSymbol: new esri.symbol.SimpleFillSymbol(
     esri.symbol.SimpleFillSymbol.STYLE_SOLID, 
     new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([ 64, 64, 64, 1 ]), 2), 
     new dojo.Color([ 0, 0, 255, 0.5 ])
   ),
   locationMarker: new esri.symbol.PictureMarkerSymbol("./information_frame.png", 16, 16)
 });
 identifyDijit.startup();

In this case, the dijit will perform the identify operation on the map services listed in the constructor with a tolerance of 2 pixels and value of the given display fields will be used to represent each identified feature. Also, the given fillSymbol and locationMarker will be used in place of their defaults.


See Also

InfoWindowConnector