Skip to content
Advertisement

Correct use of a LATERAL FROM

I am trying to use PostGIS to undertake a number of steps within an SQL statement to basically convert a raster to points, buffer, dissolve and then determine the overall boundary i.e. concave hull based on an attribute.

The following is where I am at but get an error suggesting the use of a LATERAL FROM but I do not know what I need to do.

Any assistance would be greatly appreciated.

[0A000] ERROR: aggregate function calls cannot contain set-returning function calls Hint: You might be able to move the set-returning function into a LATERAL FROM item. Position: 123

Advertisement

Answer

Just move the function ST_PixelAsCentroids() to a CROSS JOIN LATERAL and give it a label, e.g.

Although you can achieve the same results without the CROSS JOIN LATERAL

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement