5

Can anyone please tell me the difference between ST_Accum and ST_Collect of PostGIS. https://postgis.net/docs/ST_Accum.html

https://postgis.net/docs/ST_Collect.html

2 Answers 2

6

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.

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.