Table of Contents
A static circular buffer cbuffer
represents a 2D point and a radius greater than or equal to 0 around the point. The radius represent the “impact” of the point on its surroundings. This impact could be interpreted as noise, pollution, or similar aspects depending on application requirements.
The cbuffer
type serves as base type for defining the temporal circular buffer type tcbuffer
. The tcbuffer
type has similar functionality as the temporal point type tgeompoint
with the exception that it only considers two dimensions. Thus, most functions and operators described before for the tgeompoint
type are also applicable for the tcbuffer
type. In addition, there are specific functions defined for the tcbuffer
type.
A cbuffer
value is a couple of the form (point,radius)
where point
is a geometric point and radius
is a float
value greater than or equal to zero representing a radius around the point expressed using the units of the SRID of the point. Examples of input of circular buffer values are as follows:
SELECT cbuffer 'Cbuffer(Point(1 1), 0.3)'; SELECT cbuffer 'Cbuffer(Point(1 1), 10.0)';
The constructor function for circular buffers has one argument for the point and one argument for the radius. An example of a circular buffer value defined with the constructor function is as follows:
SELECT cbuffer(ST_Point(1,1), 0.3);
Values of the circular buffer type must satisfy several constraints so that they are well defined. Examples of incorrect circular buffer type values are as follows.
-- incorrect point value SELECT cbuffer 'Cbuffer(Linestring(1 1,2 2), 1.0)'; -- incorrect radius value SELECT cbuffer 'Cbuffer(Point(1 1), -2.0)';
We give next the functions and operators for the circular buffer type.
Return the spatial reference identifier
srid(cbuffer) → integer
SELECT SRID(cbuffer 'Cbuffer(SRID=5676;Point(1 1), 0.3)'); -- 5676
Set the spatial reference identifier
setSRID(cbuffer) → cbuffer
SELECT asEWKT(setSRID(cbuffer 'Cbuffer(Point(0 0),1)', 4326)); -- Cbuffer(SRID=4326;POINT(0 0),1)
Transform to a different spatial reference
transform(cbuffer,integer) → cbuffer
transform(cbuffer,pipeline text,to_srid integer,is_forward bool=true) → cbuffer
The transform
function specifies the transformation with a target SRID. An error is raised when the input circular buffer has an unknown SRID (represented by 0).
The transformPipeline
function specifies the transformation with a defined coordinate transformation pipeline represented with the following string format: urn:ogc:def:coordinateOperation:AUTHORITY::CODE
. The SRID of the input circular buffer is ignored, and the SRID of the output circular buffer will be set to zero unless a value is provided via the optional to_srid
parameter. As stated by the last parameter, the pipeline is executed by default in a forward direction; by setting the parameter to false, the pipeline is executed in the inverse direction.
SELECT asEWKT(transform(cbuffer 'SRID=4326;Cbuffer(Point(4.35 50.85),1)', 3812)); -- Cbuffer(SRID=3812;POINT(648679.0180353033 671067.0556381135),1)
WITH test(cbuffer, pipeline) AS ( SELECT cbuffer 'Cbuffer(SRID=4326;Point(4.3525 50.846667),1)', text 'urn:ogc:def:coordinateOperation:EPSG::16031' ) SELECT asEWKT(transformPipeline(transformPipeline(cbuffer, pipeline, 4326), pipeline, 4326, false), 6) FROM test; -- Cbuffer(SRID=4326;POINT(4.3525 50.846667),1)
Values of the cbuffer
type can be converted to the geometry
type using an explicit CAST
or using the ::
notation as shown next.
Similarly, a geometry
that define a circle can be converted to a cbuffer
values using an explicit CAST
or using the ::
notation. For this, the geometry must be a curve polygon with three points. If this is not the case, an error is returned.
The comparison operators (=, <, and so on) are available for circular buffers. They compare first the points and then the radius of the arguments. Excepted the equality and inequality, the other comparison operators are not useful in the real world but allow B-tree indexes to be constructed on circular buffers.
cbuffer = cbuffer
cbuffer <> cbuffer
cbuffer < cbuffer
cbuffer > cbuffer
cbuffer <= cbuffer
cbuffer >= cbuffer
SELECT cbuffer 'Cbuffer(Point(3 3), 0.5)' = cbuffer 'Cbuffer(Point(3 3), 0.5)'; -- true SELECT cbuffer 'Cbuffer(Point(3 3), 0.5)' <> cbuffer 'Cbuffer(Point(3 3), 0.6)'; -- true SELECT cbuffer 'Cbuffer(Point(3 3), 0.5)' < cbuffer 'Cbuffer(Point(3 3), 0.6)'; -- true SELECT cbuffer 'Cbuffer(Point(3 3), 0.6)' > cbuffer 'Cbuffer(Point(2 2), 0.6)'; -- true SELECT cbuffer 'Cbuffer(Point(1 1), 0.5)' <= cbuffer 'Cbuffer(Point(2 2), 0.5)'; -- true SELECT cbuffer 'Cbuffer(Point(1 1), 0.6)' >= cbuffer 'Cbuffer(Point(1 1), 0.5)'; -- true