Categories:

Geospatial Functions

ST_COVERS

This returns true if no point in geography g2 is outside geography g1.

ST_COVERS is similar to, but subtly different from, ST_CONTAINS. For details, see:

See also:

ST_CONTAINS

Syntax

ST_COVERS( <geography_expression_1> , <geography_expression_2> )

Arguments

geography_expression_1

A GEOGRAPHY object.

geography_expression_2

A GEOGRAPHY object.

Returns

BOOLEAN.

Examples

This shows a simple use of the ST_COVERS 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))');
SELECT ST_COVERS(g1, g2) 
    FROM geospatial_table_01;
+-------------------+
| ST_COVERS(G1, G2) |
|-------------------|
| True              |
+-------------------+