Categorias:

Funções geospaciais

ST_INTERSECTION_AGG

Dada uma coluna GEOGRAPHY, retorna um objeto GEOGRAPHY que representa a forma que contém o conjunto combinado de pontos que são comuns às formas representadas pelos objetos na coluna (ou seja, a interseção das formas).

Consulte também:

ST_INTERSECTION , ST_UNION_AGG

Sintaxe

ST_INTERSECTION_AGG( <geography_column> )
Copy

Argumentos

geography_column

Uma coluna GEOGRAPHY.

Retornos

A função retorna um valor do tipo GEOGRAPHY.

Exemplos

Crie uma tabela com uma coluna GEOMETRY e insira dados:

CREATE OR REPLACE TABLE st_intersection_agg_demo_table (g GEOGRAPHY);

INSERT INTO st_intersection_agg_demo_table VALUES
  ('POLYGON((10 10, 11 11, 11 10, 10 10))'),
  ('POLYGON((10 10, 11 10, 10 11, 10 10))'),
  ('POLYGON((10.5 10.5, 10 10, 11 10, 10.5 10.5))');
Copy

Use a função ST_INTERSECTION_AGG para retornar um objeto GEOGRAPHY que representa a interseção das formas representadas pelos objetos na coluna GEOGRAPHY:

ALTER SESSION SET GEOGRAPHY_OUTPUT_FORMAT = 'WKT';

SELECT ST_INTERSECTION_AGG(g) AS intersection_of_shapes
  FROM st_intersection_agg_demo_table;
Copy
+--------------------------------------------+
| INTERSECTION_OF_SHAPES                     |
|--------------------------------------------|
| POLYGON((10.5 10.5,10 10,11 10,10.5 10.5)) |
+--------------------------------------------+