You need to do
CREATE EXTENSION postgis_sfcgal;
It’s not part of the postgis extension. If you don’t have that extension, then
you can’t use this function.
You next best bet is using ST_ConcaveHull
https://postgis.net/docs/ST_ConcaveHull.html
From: postgis-users On
Hi, Regina,
It did not work.
ERROR: function st_optimalalphashape(geometry) does not exist LINE 1:
SELECT min(gs) , max(gs), st_optimalalphashape(st_collect(S... ^ HINT: No
function matches the given name and argument types. You might need to add
explicit type casts. SQL state: 42883 Character:
You are using the wrong version of ST_Collect. You want to use the aggregate
form. You are using the two point form -
https://postgis.net/docs/en/ST_Collect.html
Also when you aggregate, you can’t include the gs in there.
Try:
SELECT min(gs) , max(gs),
I tested St_optimalphashape and it does not work.
select gs,
st_optimalalphashape(st_collect(ST_MakePoint(random()*10,random()*10),ST_MakePoint(random()*10,random()*10))::geometry)
from generate_series(1,100) gs;
Example given here does not work either.
ST_OptimalAlphaShape (postgis.net)