Identifies or queries features on a layer based on a screen-point and an expand-percentage tolerance.
Syntax
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 Basic | Copy 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
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