|Delegation Rules: WHERE Clause / WHERE Clause Examples for Delegation|
ContainsCentroid is a spatial operator that evaluates whether an object is entirely contained by a given geometry. ContainsCentroid is the inverse operator to CentroidWithin.
SELECT city FROM table WHERE obj ContainsCentroid <geometry>
If the data source provider supports ContainsCentroid: the entire query is delegated to the data provider.
If the data source provider does not support ContainsCentroid, the query is converted to an EnvelopesIntersect and delegated to the data source provider. EnvelopesIntersects returns a larger set of rows than ContainsCentroid, but it is fewer than returning the entire table.
SELECT city, obj FROM table WHERE obj EnvelopesIntersect <geometry>
Spectrum Spatial evaluates ContainsCentroid using the results from the data source provider.
SELECT city FROM <results from the delegation> WHERE obj ContainsCentroid <geometry>
SELECT city FROM table WHERE <geometry> ContainsCentroid obj
This example is the opposite of the first example. It is also equivalent to the CentroidWithin operator when the operands are reversed.
As written, this query does not meet the rules of the WHERE clause, where boolean operators must be in the form WHERE <column> operator <geometry>. The query is rephrased as a CentroidWithin operation and delegated to the data source provider.
SELECT city FROM table WHERE obj CentroidWithin <geometry>