Can anyone please tell me the difference between ST_Accum and ST_Collect of PostGIS. https://postgis.net/docs/ST_Accum.html
2 Answers
The ST_Accum
function creates an array of input geometries, while ST_Collect
creates a Geometry collection.
Think of it this way. If your inputs are a Bunch of Points, ST_Accum
will return an array of points, while ST_Collect
will return a Multi-Point.
If the inputs were lines, the ST_Collect
would return a Multi-Line and so on.
The role of ST_accum
and ST_Collect
are different :
- The
ST_Accum
functions creates an array of input geometries (doc), - while
ST_Collect
function create a geometry from an input array (doc).
So, you can use the output of ST_Accum
as the input of ST_Collect
.
The inverse will create an array with one element.