Name

ST_Accum — Aggregate. Constructs an array of geometries.

Synopsis

geometry[] ST_Accum(geometry set geomfield);

Description

Aggregate. Constructs an array of geometries.

This function supports 3d and will not drop the z-index.

This method supports Circular Strings and Curves

Examples

SELECT (ST_Accum(the_geom)) As all_em, ST_AsText((ST_Accum(the_geom))[1]) As grabone,
(ST_Accum(the_geom))[2:4] as grab_rest
			FROM (SELECT ST_MakePoint(a*CAST(random()*10 As integer), a*CAST(random()*10 As integer), a*CAST(random()*10 As integer)) As the_geom
				FROM generate_series(1,4) a) As foo;

all_em|grabone   | grab_rest

-------------------------------------------------------------------------------+

 {0101000080000000000000144000000000000024400000000000001040:
 0101000080000000000
00018400000000000002C400000000000003040:
0101000080000000000000354000000000000038400000000000001840:
010100008000000000000040400000000000003C400000000000003040} |
 POINT(5 10) | {010100008000000000000018400000000000002C400000000000003040:
 0101000080000000000000354000000000000038400000000000001840:
 010100008000000000000040400000000000003C400000000000003040}
(1 row)
		

See Also

ST_Collect