MapGuide API Reference
 All Classes Functions Variables Enumerations Enumerator Friends
void MgFeatureQueryOptions::SetSpatialFilter ( CREFSTRING  geometryProperty,
MgGeometry geometry,
INT32  spatialOperation 
)

Use this method to select features whose geometry property satisfies the relationship argument to the geometry argument. The effect is geometryProperty.spatialOperation(geometryArg). By default this filter is joined by the AND operator with the value of the regular filter (see MgFeatureQueryOptions::SetFilter Method ). This filter can also be joined by the OR operator (see MgFeatureQueryOptions::SetBinaryOperator Method ). The syntax for including a spatial expression in a regular filter is described in the topic on filters and expressions .

Remarks:
The XML returned by MgFeatureService::GetCapabilities says whether a provider supports spatial conditions. Even if it supports spatial conditions, the provider may not support all spatial operations. See Provider Capabilities .
For example, let's call this method with the arguments "geometry" (the name of the geometry property), "MgFeatureSpatialOperations::Touches (the spatial operation) and the geometry POLYGON((0 2, 5 2, 5 3, 0 3, 0 2)) after conversion into an MgGeometry object. Let's assume that the MgFeatureQueryOptions::SetBinaryOperator method is not called and the value of the MgFeatureQueryOptions::SetFilter() method argument is "featid > 0". Let's also assume that the MgFeatureQueryOptions::AddFeatureProperty() method has been called twice, one with an argument of "featid" and once with an argument "geometry". We further assume that the MgFeatureService::SelectFeatures() method is called with the classname argument set to "featclass". This is equivalent to doing this select statement: "SELECT a.featid,a.geometry FROM featclass a WHERE (a.featid > 0) AND sdo_relate(a.geometry, MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1), MDSYS.SDO_ORDINATE_ARRAY(0,2, 5,2, 5,3, 0,3, 0,2)), 'mask=touch) = 'TRUE';"
.NET Syntax
void SetSpatialFilter(string geometryProperty, MgGeometry geometry, int spatialOperation);
Java Syntax
void SetSpatialFilter(String geometryProperty, MgGeometry geometry, int spatialOperation);
PHP Syntax
void SetSpatialFilter(string geometryProperty, MgGeometry geometry, int spatialOperation);
Parameters:
geometryProperty(String/string) The name of the geometry property belonging the features selected from the datastore
geometry(MgGeometry) The geometry object set in relation to the geometry property.
spatialOperation(int) The spatial operation to perform between the lefthand operand (the geometry property) and the righthand operand (the geometry object). The spatial operation value of is one of the MgFeatureSpatialOperations types.
Returns:
Returns nothing.
Exceptions:
MgInvalidArgumentException