ESRI.ArcGIS.ADF.IMS
Identify(Int32,Int32,Double) Method
See Also  Example Send Feedback
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace > FeatureLayer Class > Identify Method : Identify(Int32,Int32,Double) Method




pixelX
X-coordinate of the screen-point.
pixelY
Y-coordinate of the screen-point. Zero is at the top of the image.
expandPercentage
Percentage-based tolerance to determine the size of the envelope created around the point.
Identifies or queries features on a layer based on a screen-point and an expand-percentage tolerance.

Syntax

Visual Basic (Declaration) 
Public Overloads Function Identify( _
   ByVal pixelX As Integer, _
   ByVal pixelY As Integer, _
   ByVal expandPercentage As Double _
) As FeatureTable
Visual Basic (Usage)Copy Code
Dim instance As FeatureLayer
Dim pixelX As Integer
Dim pixelY As Integer
Dim expandPercentage As Double
Dim value As FeatureTable
 
value = instance.Identify(pixelX, pixelY, expandPercentage)
C# 
public FeatureTable Identify( 
   int pixelX,
   int pixelY,
   double expandPercentage
)

Parameters

pixelX
X-coordinate of the screen-point.
pixelY
Y-coordinate of the screen-point. Zero is at the top of the image.
expandPercentage
Percentage-based tolerance to determine the size of the envelope created around the point.

Return Value

FeatureTable object containing the identified features.

Example

The following example identifies the country at a point on the map in screen coordinates. If features are found, they are displayed in a DetailsView control. Note that a DetailsView only displays the first record in the DataTable.
C#Copy Code
// Get a reference to the layer
FeatureLayer theLayer =
    (FeatureLayer)mapView.Layers.FindByName("Countries");
 
// Define the identify location
int mapPixelX = 250;
int mapPixelY = 100;
double expandPct = 2.0;
 
// Perform identify, returning a FeatureTable
FeatureTable identifyResultsTable = theLayer.Identify(mapPixelX, mapPixelY, expandPct);
 
// If features found, display in a GridView
if (identifyResultsTable.Rows.Count > 0)
{
    DetailsView1.DataSource = identifyResultsTable;
    DetailsView1.DataBind();
}
else
{
    Label1.Text = "No features found.";
}
Visual BasicCopy Code
' Get a reference to the layer
Dim theLayer As FeatureLayer = _
    CType(mapView.Layers.FindByName("Countries"), FeatureLayer)
 
' Define the identify location
Dim mapPixelX As Integer = 250
Dim mapPixelY As Integer = 100
Dim expandPct As Double = 2.0
 
' Perform identify, returning a FeatureTable
Dim identifyResultsTable As FeatureTable = _
    theLayer.Identify(mapPixelX, mapPixelY, expandPct)
 
' If features found, display in a GridView
If identifyResultsTable.Rows.Count > 0 Then
 
    DetailsView1.DataSource = identifyResultsTable
    DetailsView1.DataBind()
 
Else
    Label1.Text = "No features found."
End If

Remarks

This is a convenient way to identify features near a point on the map. It is similar to using a Query method with a point in the filter of the query parameters.

The x and y coordinate parameters must be pixel coordinates for the map image. The MapView's height and width must have been set in the ImageDescriptor in order to properly calculate the position on the map. If you have map coordinates instead of pixel coordinates, it is recommended to use Identify(Point, double), in order to avoid converting map coordinates to pixel coordinates and then back to map coordinates.

The expandPercentage is the percentage of the current map extent. An envelope of the specified size is constructed centered on the input point. The expandPercentage value must be greater than zero, and no greater than 100.

This method returns a FeatureTable. Since a FeatureTable inherits from System.Data.DataTable, it can be used as the data source for data-bound controls that accept a DataTable, such as the GridView control or DetailsView control. This can make it simple to display the results of a query or identify operation.

If no features are found, the method returns a DataTable with no rows. Check the DataTable's Rows.Count property to see whether any features are found.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2011 All Rights Reserved.