📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

ST_ENVELOPE_AGG



Aggregates multiple GEOMETRY values and returns the minimum bounding rectangle that covers all non-NULL inputs.

This function supports GEOMETRY only.

Syntax

ST_ENVELOPE_AGG(<geometry>)

Arguments

ArgumentsDescription
<geometry>An expression of type GEOMETRY.

Return Type

GEOMETRY.

Example

WITH data AS ( SELECT TO_GEOMETRY('POINT(1 1)') AS g UNION ALL SELECT TO_GEOMETRY('POINT(4 2)') UNION ALL SELECT TO_GEOMETRY('POINT(2 5)') ) SELECT ST_ASWKT(ST_ENVELOPE_AGG(g)) FROM data; ╭────────────────────────────────╮ │ st_aswkt(st_envelope_agg(g)) │ ├────────────────────────────────┤ │ POLYGON((1 1,4 1,4 5,1 5,1 1)) │ ╰────────────────────────────────╯

Was this page helpful?