I have this points represented as geom:
And when I apply:
ST_MakeLine(points.geom) I got this:
When I need something like closing/bounding line (and even better the whole area as 1 geom):
This is how I get the points for example:
SELECT DISTINCT (ST_DumpPoints(buildings.geom)).geom --AS geom FROM buildings WHERE ST_DWithin(buildings.geom, ST_GeomFromText('POINT(lon lat)', 4326), radius)
ST_ConcaveHull(ST_Collect(vertices.geom), 0.99, false) resulted almost the solution:
The reason is as documented here: "he basic approach is that it first creates a convexhull of the geometry and then uses the ST_ClosestPoint function introduced in PostGIS 1.5 to cave in the hull to transform it into a concave hull. That's the basic idea". We can see that the points not connected properly are those where the issue with the closest point is Misleading...