Can anyone please tell me the difference between ST_Accum and ST_Collect of PostGIS. https://postgis.net/docs/ST_Accum.html
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_Collect are different :
ST_Accumfunctions creates an array of input geometries (doc),
ST_Collectfunction create a geometry from an input array (doc).
So, you can use the output of
ST_Accum as the input of
The inverse will create an array with one element.