I'd like to create a boundary of a set of point using ST_ConcaveHull
function in PostGIS
My query works fine and I can see the polygon through the geometry viewer embedded in the pgadmin.
CREATE TABLE boundary AS
SELECT row_number() OVER () As id, ST_ConcaveHull(ST_Collect(p.geom), 0.99) As geom
FROM mypoints p;
However, when I try to load the table in QGIS, it gives me an error saying the layer is invalid
.
I try to explicitly define the geometry type as polygon, but this error Geometry type (GeometryCollection) does not match column type (Polygon)
CREATE TABLE boundary AS
SELECT row_number() OVER () As id, ST_ConcaveHull(ST_Collect(p.geom), 0.99)::geometry(POLYGON,4326) As geom
FROM mypoints p;
How do I refine my query to create a table that can be recognised by QGIS?