Selecting with the Web API

Selections can be created programatically with the Web API. This is done by querying data in a feature source, creating a feature reader that contains the features, then converting the feature reader to a selection (MgSelection object).

To create a feature reader, apply a selection filter to a feature class in the feature source. A selection filter can be a basic filter, a spatial filter, or a combination of the two. The filter is stored in an MgFeatureQueryOptions object.

Basic filters are used to select features based on the values of feature properties. For example, you could use a basic filter to select all roads that have four or more lanes.

Spatial filters are used to select features based on their geometry. For example, you could use a spatial filter to select all roads that intersect a certain area.

#### Topics in this section

- Basic Filters
- Spatial Filters