ST_ExpandSpatial

更新时间:
复制 MD 格式

Expands the spatial dimensions of a boxndf bounding box by a specified amount. The time dimension, if present, is not affected.

Syntax

boxndf ST_ExpandSpatial(boxndf box, float8 len);

Parameters

ParameterTypeDescription
boxboxndfThe bounding box to expand.
lenfloat8The expansion distance. Each spatial axis is expanded by len in both directions: the lower bound decreases by len and the upper bound increases by len.

Description

ST_ExpandSpatial expands the x, y, and z dimensions of a boxndf bounding box outward by len units on each side.

Example

The following example creates a 2D+time bounding box using ST_MakeBox2dt, then expands its spatial dimensions by 4 units.

SELECT ST_ExpandSpatial(ST_MakeBox2dt(0, 0, '2000-01-02', 20, 20, '2000-03-03'), 4);

Result:

BOX2DT(-4 -4 2000-01-02 00:00:00,24 24 2000-03-03 00:00:00)

The x and y ranges each expand by 4 in both directions: [0, 20] becomes [-4, 24]. The time range (2000-01-02 to 2000-03-03) is unchanged because ST_ExpandSpatial only affects spatial dimensions.