Show in Contents

Add to Favorites

Home: MapGuide Developer's Guide
Examples

Selecting with the Web API

Creating Geometry Objects From Features
Spatial Filters
With
spatial filters, you can do comparisons using geometric properties.
For example, you can select all features that are inside an area
on the map, or that intersect an area.
There are two ways of using spatial filters:
- Create
a separate spatial filter to apply to the feature source, using
the MgFeatureQueryOptions::SetSpatialFilter() method.
- Include
spatial properties in a basic filter created with the MgFeatureQueryOptions::SetFilter() method.
The MgFeatureQueryOptions::SetSpatialFilter() method
requires an MgGeometry object
to define the geometry and a spatial operation to compare the feature
property and the geometry. The spatial operations are defined in class MgFeatureSpatialOperations.
To include spatial properties
in a basic filter, define the geometry using WKT format. Use the GEOMFROMTEXT() function in the basic
filter, along with one of the following spatial operations:
- CONTAINS
- COVEREDBY
- CROSSES
- DISJOINT
- EQUALS
- INTERSECTS
- OVERLAPS
- TOUCHES
- WITHIN
- INSIDE
NoteNot all spatial operations
can be used on all features. It depends on the capabilities of the
FDO provider that supplies the data. This restriction applies to separate
spatial filters and spatial properties that are used in a basic
filter.