I have these points
stored in my database. Now I am trying to use to create a Voronoi diagram with ST_VoronoiPolygons(). I have tried doing:
SELECT
(ST_DUMP(ST_VoronoiPolygons(ST_Collect(geog)))).geom
FROM sources;
But this returns an error:
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 42
The goal is to turn the points into polygons. I have also tried
WITH sources(geog) AS
(SELECT
ST_MakePoint(random(), random())
FROM generate_series(1, 1342))
SELECT
(ST_DUMP(ST_VoronoiPolygons(ST_Collect(geom)))).geom
FROM points;
But this just returned a square Voronoi and not a Voronoi diagram.
Best Answer
ST_VoronoiPolygons only works on geometry data types not geography data types.
CREATE TABLE voronoi_dump AS SELECT (st_dump(ST_VoronoiPolygons(st_collect(geog::geometry)))).geom FROM sources;