I am fairly new to all of this but in simplistic terms I have the following problem: I need to create lines from points, and from said points group all of those within n distance of one another. From this grouping I need to return the concave hull nice and tight. This bit is easy but I need to retain an understanding of the attribution of the points I originally manipulated.
In the table I have the following:
point_1, point_2, ID_1, ID_2
from this I have designed the query for the aggregation as follows:
SELECT ST_AsText( ST_ConcaveHull(unnest( ST_ClusterWithin( ST_MakeLine(table.point_1, table.point_2),0.00010008999 ) ),0.99)::geometry ) AS aggr FROM tb1 AS table
This appears to meet my requirements however how could I also return a list of all ID_1's and ID_2's whose geometries have gone through the aggregation process for example:
aggr | ID_1s | ID_2's | _____________________________________________ POLYGON(123...) | 1,2,3,4,5.. | 66,33,45... POLYGON(566...) | 9,3,5,0,2.. | 21,53,65...
I have struggled to ask the question almost as much as I have to solutionize my problem (without success).