Within 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

Within is a boolean spatial operator that evaluates whether an object, such as a polygon, contains all of another geometry.

Example 1:

SELECT city FROM table WHERE obj Within <geometry>

If the data source provider supports Within, the entire query is delegated to the data source provider.

If the data source provider does not support Within, the query is converted to an EnvelopesIntersect and delegated as follows:

SELECT city, obj FROM table WHERE obj EnvelopesIntersect <geometry>

Spectrum Spatial evaluates Within using the results from the data source provider:

SELECT city FROM <results of the delegation> WHERE obj Within <geometry>

Example 2:

SELECT city FROM table WHERE <geometry> Within obj

This example is the opposite of the first example. It is the inverse of the Contains operator with the operands 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 Contains operation and delegated according to the rules for Contains.

SELECT city FROM table WHERE obj Contains <geometry>