[postgis-devel] TIN

Stephen Mather mather.stephen at gmail.com
Sun Feb 10 11:19:49 PST 2013


Hi All,
     Working on the question of Delaunay triangulation in PostGIS 2.1/GEOS
3.4.  I wrote a quick function to wrap the existing
ST_DelaunayTriangulation so that it would output a TIN Z instead, which is
a very hackerish string-replace with no checks for the validity of the TIN
(convert triangulation to text, replace references to POLYGON Z and
GEOMETRYCOLLECTION Z, feed back into GeomFromEWKT):

CREATE OR REPLACE FUNCTION chp07.AsTIN(geometry)
  RETURNS geometry AS
$BODY$

WITH dt AS
(
SELECT ST_AsText(ST_DelaunayTriangles(ST_Collect($1))) AS atext
),
replacedt AS
(
SELECT replace(atext, 'POLYGON Z', '') as ttext
  FROM dt
),
replacegc AS
(
SELECT replace(ttext, 'GEOMETRYCOLLECTION Z', 'TIN') AS tintext
  from replacedt
),
tingeom AS
(
SELECT ST_GeomFromEWKT(tintext) AS the_geom FROM replacegc
)

SELECT the_geom FROM tingeom

$BODY$
  LANGUAGE sql VOLATILE
  COST 100;
ALTER FUNCTION chp07.AsTIN(geometry)
  OWNER TO postgres;

Anyway, the function is a patch so I can generate a TIN from a point cloud
and be able to output to the web via X3D and ST_DelaunayTriangulation, but
wonder now where in the timeline is a function that creates a TIN from a
point cloud lest others are doing smarter things than a couple of nested
replace()?  How does this relate to the potential integration of CGAL (
http://www.oslandia.com/tech/?p=1235) etc..

Thanks,
Best,
Steve Mather
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20130210/06398296/attachment.html>


More information about the postgis-devel mailing list