CentroidWithin Operator - Latest

Spectrum Spatial Guide

Product type
Software
Portfolio
Locate
Product family
Spectrumâ„¢ software
Product
Spectrumâ„¢ software > Spatial > Spectrum Spatial
Version
Latest
ft:locale
en-US
Product name
Spectrum Technology Platform
ft:title
Spectrum Spatial Guide
Copyright
2025
First publish date
2007
ft:lastEdition
2025-09-26
ft:lastPublication
2025-09-26T10:03:58.880000

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>
Example 2:
SELECT city FROM table WHERE <geometry> CentroidWithin obj

This 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>