CentroidWithin is a spatial operator that evaluates whether an object is entirely within another geometry. CentroidWithin is the inverse operator to ContainsCentroid.
Example 1:
SELECT city FROM table WHERE obj CentroidWithin <geometry>If the data source provider supports CentroidWithin: the entire query is delegated to the data provider.
If the data source provider does not support CentroidWithin, the query is converted to an EnvelopesIntersect and delegated as follows:
SELECT city, obj FROM table WHERE obj EnvelopesIntersect <geometry>Spectrum Spatial evaluates CentroidWithin using the results from the data source provider:
SELECT city FROM <results from the delegation> WHERE obj CentroidWithin <geometry>SELECT city FROM table WHERE <geometry> CentroidWithin objThis example is the opposite of Example 1. It is also equivalent to the ContainsCentroid operator when the operands are reversed.
As written, this query does not meet Rule 2 for the
WHERE clause, where boolean operators must be in the form WHERE <column> operator
<geometry>. The query is rephrased as a ContainsCentroid operation and delegated to
the data source provider.
SELECT city FROM table WHERE obj ContainsCentroid <geometry>