A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/st_contains below:

Website Navigation


ST_CONTAINS | Snowflake Documentation

ST_CONTAINS

Returns TRUE if a GEOGRAPHY or GEOMETRY object is completely inside another object of the same type.

More strictly, object g1 contains object g2 if and only if no points of g2 lie in the exterior of g1, and at least one point of the interior of B lies in the interior of A. There are certain subtleties in this definition that are not immediately obvious. For more details on what “contains” means, see the Dimensionally Extended 9-Intersection Model (DE-9IM).

Although ST_COVERS and ST_CONTAINS might seem similar, the two functions have subtle differences. For details on the differences between “covers” and “contains”, see the Dimensionally Extended 9-Intersection Model (DE-9IM).

Note

This function does not support using a GeometryCollection or FeatureCollection as input values.

Tip

You can use the search optimization service to improve the performance of queries that call this function. For details, see Search Optimization Service.

See also:

ST_WITHIN , ST_COVERS , ST_COVEREDBY

Syntax
ST_CONTAINS( <geography_expression_1> , <geography_expression_2> )

ST_CONTAINS( <geometry_expression_1> , <geometry_expression_2> )

Copy

Arguments
geography_expression_1

A GEOGRAPHY object that is not a GeometryCollection or FeatureCollection.

geography_expression_2

A GEOGRAPHY object that is not a GeometryCollection or FeatureCollection.

geometry_expression_1

A GEOMETRY object that is not a GeometryCollection or FeatureCollection.

geometry_expression_2

A GEOMETRY object that is not a GeometryCollection or FeatureCollection.

Returns

BOOLEAN.

Usage notes Examples GEOGRAPHY examples

This shows a simple use of the ST_CONTAINS function:

create table geospatial_table_01 (g1 GEOGRAPHY, g2 GEOGRAPHY);
insert into geospatial_table_01 (g1, g2) values 
    ('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0))', 'POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))');

Copy

SELECT ST_CONTAINS(g1, g2) 
    FROM geospatial_table_01;
+---------------------+
| ST_CONTAINS(G1, G2) |
|---------------------|
| True                |
+---------------------+

Copy

GEOMETRY examples

The query below shows several examples of using ST_CONTAINS. Note how ST_CONTAINS determines that:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4