I am trying to generate a Cost Distance table using Spatialite. I have several points in the table random_points for which I would like to compute the Delaunay triangulation and use the segments it produces as arcs. Something like:
SELECT ST_DelaunayTriangulation(ST_Collect(Geometry)) FROM random_points;
And the reuse its output. How can this be achieved?
Alternatively, I have thought about generating the lines connecting each pair of random points (there will be millions of these, the total number of random_points is around 4000) and then to keep those that appear in the Delaunay triangulation. Something of that sort:
WITH dela AS (SELECT ST_DelaunayTriangulation(ST_Collect(Geometry), 1, 0) FROM random_points), g1 AS (SELECT mergename, geometry FROM random_points), g2 AS (SELECT mergename, geometry FROM random_points) SELECT g1.mergename, g2.mergename, AsText(MakeLine(g1.geometry, g2.geometry)) FROM g1, g2 WHERE MakeLine(g1.geometry, g2.geometry) IN dela;
Any idea how to tweak it if the syntax is right?