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_intersection below:

Website Navigation


ST_INTERSECTION | Snowflake Documentation

Categories:

Geospatial functions

ST_INTERSECTION

Given two input GEOGRAPHY objects, returns a GEOGRAPHY object that represents the shape containing the set of points that are common to both input objects (i.e. the intersection of the two objects).

See also:

ST_INTERSECTION_AGG , ST_UNION , ST_DIFFERENCE , ST_SYMDIFFERENCE

Syntax
ST_INTERSECTION( <geography_expression_1> , <geography_expression_2> )

Copy

Arguments
geography_expression_1

A GEOGRAPHY object.

geography_expression_2

A GEOGRAPHY object.

Returns

The function returns a value of type GEOGRAPHY.

Usage notes Examples

The following example returns a GEOGRAPHY object that represents the intersection of two input GEOGRAPHY objects:

ALTER SESSION SET GEOGRAPHY_OUTPUT_FORMAT = 'WKT';

SELECT ST_INTERSECTION(
  TO_GEOGRAPHY('POLYGON((0 0, 1 0, 2 1, 1 2, 2 3, 1 4, 0 4, 0 0))'),
  TO_GEOGRAPHY('POLYGON((3 0, 3 4, 2 4, 1 3, 2 2, 1 1, 2 0, 3 0))'))
AS intersection_of_objects;

Copy

This example produces the following output:

+-----------------------------------------------------------------------------------------------------------------------------------------+
| INTERSECTION_OF_OBJECTS                                                                                                                 |
|-----------------------------------------------------------------------------------------------------------------------------------------|
| MULTIPOLYGON(((1.5 0.5000571198,2 1,1.5 1.500171359,1 1,1.5 0.5000571198)),((1.5 2.500285599,2 3,1.5 3.500399839,1 3,1.5 2.500285599))) |
+-----------------------------------------------------------------------------------------------------------------------------------------+

Copy

The following images illustrate the differences in the areas that represent the input and output objects:


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