ESRI.ArcGIS.ADF.IMS
Filter Class
Members  Example  See Also  Send Feedback
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace : Filter Class




An object that is used for filtering features.

Object Model

Filter Class

Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class Filter 
Visual Basic (Usage)Copy Code
Dim instance As Filter
C# 
[SerializableAttribute()]
public class Filter 

Example

The following example uses a Filter to highlight land parcels that intersect an envelope and that are valued at over $10,000,000. The land values are in a joined table, so the JoinTables includes the joined table name, and the WhereExpression includes the relationship between the layer's attributes and the joined table.
C#Copy Code
FeatureLayer theLayer = mapView.Layers.FindByName("Parcels");
 
Filter theFilter = new Filter();
 
// Add the attribute table to the JoinTables collection
theFilter.JoinTables.Add("DB.map.Parcel_values");
 
// Create an envelope to select within
Envelope selectEnv = new Envelope(556000, 41000, 560000, 43000);
theFilter.Geometry = selectEnv;
 
// Select parcels valued over 10,000,000
theFilter.WhereExpression = "DB.map.Parcels.APN = DB.map.Parcel_values.APN and DB.map.Parcel_values.LandValue > 10000000";
theFilter.SearchOrder = SearchOrder.AttributeFirst;
 
// Create renderer for the highlight layer
SimpleFillSymbol simpleFill = new SimpleFillSymbol(Drawing.Color.Yellow, Drawing.Color.Yellow, PolygonFillType.DarkGray);
SimpleRenderer simpleRend = new SimpleRenderer(simpleFill);
 
// Create the highlight layer
FeatureLayer hiliteLayer = theLayer.CreateSelectionLayer(theFilter, simpleRend, "parcelSelection");
 
mapView.Layers.Add(hiliteLayer);
Visual BasicCopy Code
Dim theLayer As FeatureLayer = mapView.Layers.FindByName("Parcels")
 
Dim theFilter As New Filter()
 
' Add the attribute table to the JoinTables collection
theFilter.JoinTables.Add("DB.map.Parcel_values")
 
' Create an envelope to select within
Dim selectEnv As New Envelope(556000, 41000, 560000, 43000)
theFilter.Geometry = selectEnv
 
' Select parcels valued over 10,000,000
theFilter.WhereExpression = "DB.map.Parcels.APN = DB.map.Parcel_values.APN and DB.map.Parcel_values.LandValue > 10000000"
theFilter.SearchOrder = SearchOrder.AttributeFirst
 
' Create renderer for the highlight layer
Dim simpleFill As New SimpleFillSymbol(Drawing.Color.Yellow, Drawing.Color.Yellow, PolygonFillType.DarkGray)
Dim simpleRend As New SimpleRenderer(simpleFill)
 
' Create the highlight layer
Dim hiliteLayer As FeatureLayer = theLayer.CreateSelectionLayer(theFilter, simpleRend, "parcelSelection")
 
mapView.Layers.Add(hiliteLayer)

Remarks

A Filter can be used to query a dataset in one of three ways:
  1. A tabular query based on the value of attributes. For example, an attribute query asks for all cities in Canada where the population is greater than 500,000.
  2. A spatial query based on features selected on a map. For example, a rectangle might be dragged over the eastern United States to select a group of cities.
  3. A combination of a tabular and spatial query. For example, a group of cities might be selected, but only cities with a population greater than 500,000 are displayed.

A Filter can also used to join DBF files to shapefiles and to relate tables in ArcSDE.

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.