From 244a939935e17913e8817b3b786e49d5a5f5413f Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Sat, 5 Mar 2011 06:07:28 +0000 Subject: [PATCH] more examples of TIN and polyhedral surfaces git-svn-id: http://svn.osgeo.org/postgis/trunk@6876 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_accessor.xml | 50 +++++++++++++++++++++++++++++++----- doc/reference_processing.xml | 32 ++++++++++++++++++++--- 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/doc/reference_accessor.xml b/doc/reference_accessor.xml index ad6d9368c..ed77e2634 100644 --- a/doc/reference_accessor.xml +++ b/doc/reference_accessor.xml @@ -499,10 +499,9 @@ LINESTRING(0 0 1,1 1 1,1 2 1,1 1 1,0 0 1) - Examples + Standard Examples - ---Extracting a subset of points from a 3d multipoint + --Extracting a subset of points from a 3d multipoint SELECT n, ST_AsEWKT(ST_GeometryN(the_geom, n)) As geomewkt FROM ( VALUES (ST_GeomFromEWKT('MULTIPOINT(1 2 7, 3 4 7, 5 6 7, 8 9 10)') ), @@ -524,10 +523,47 @@ WHERE n <= ST_NumGeometries(the_geom); --Extracting all geometries (useful when you want to assign an id) SELECT gid, n, ST_GeometryN(the_geom, n) FROM sometable CROSS JOIN generate_series(1,100) n -WHERE n <= ST_NumGeometries(the_geom); - - - +WHERE n <= ST_NumGeometries(the_geom); + + +Polyhedral Surfaces, TIN and Triangle Examples +-- Polyhedral surface example +-- Break a Polyhedral surface into its faces +SELECT ST_AsEWKT(ST_GeometryN(p_geom,3)) As geom_ewkt + FROM (SELECT ST_GeomFromEWKT('POLYHEDRALSURFACE( +((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)), +((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), +((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), +((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)), +((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), +((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) +)') AS p_geom ) AS a; + + geom_ewkt +------------------------------------------ + POLYGON((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)) + +-- TIN -- +SELECT ST_AsEWKT(ST_GeometryN(geom,2)) as wkt + FROM + (SELECT + ST_GeomFromEWKT('TIN ((( + 0 0 0, + 0 0 1, + 0 1 0, + 0 0 0 + )), (( + 0 0 0, + 0 1 0, + 1 1 0, + 0 0 0 + )) + )') AS geom + ) AS g; +-- result -- + wkt +------------------------------------- + TRIANGLE((0 0 0,0 1 0,1 1 0,0 0 0)) diff --git a/doc/reference_processing.xml b/doc/reference_processing.xml index ba12fcfe3..05206aa55 100644 --- a/doc/reference_processing.xml +++ b/doc/reference_processing.xml @@ -1038,7 +1038,7 @@ MULTIPOINT(-118.6 38.329 6,-118.58 38.38 5) - Examples + Standard Examples SELECT sometable.field1, sometable.field1, (ST_Dump(sometable.the_geom)).geom AS the_geom FROM sometable; @@ -1053,9 +1053,9 @@ SELECT ST_AsEWKT(a.geom), ST_HasArc(a.geom) CIRCULARSTRING(0 0,1 1,1 0) | t LINESTRING(1 0,0 1) | f (2 rows) - - --- Polyhedral surface example + +Polyhedral Surfaces, TIN and Triangle Examples +-- Polyhedral surface example -- Break a Polyhedral surface into its faces SELECT (a.p_geom).path[1] As path, ST_AsEWKT((a.p_geom).geom) As geom_ewkt FROM (SELECT ST_Dump(ST_GeomFromEWKT('POLYHEDRALSURFACE( @@ -1072,6 +1072,30 @@ SELECT (a.p_geom).path[1] As path, ST_AsEWKT((a.p_geom).geom) As geom_ewkt 4 | POLYGON((1 1 0,1 1 1,1 0 1,1 0 0,1 1 0)) 5 | POLYGON((0 1 0,0 1 1,1 1 1,1 1 0,0 1 0)) 6 | POLYGON((0 0 1,1 0 1,1 1 1,0 1 1,0 0 1)) + +-- TIN -- +SELECT (g.gdump).path, ST_AsEWKT((g.gdump).geom) as wkt + FROM + (SELECT + ST_Dump( ST_GeomFromEWKT('TIN ((( + 0 0 0, + 0 0 1, + 0 1 0, + 0 0 0 + )), (( + 0 0 0, + 0 1 0, + 1 1 0, + 0 0 0 + )) + )') ) AS gdump + ) AS g; +-- result -- + path | wkt +------+------------------------------------- + {1} | TRIANGLE((0 0 0,0 0 1,0 1 0,0 0 0)) + {2} | TRIANGLE((0 0 0,0 1 0,1 1 0,0 0 0)) + See Also -- 2.50.1