]> granicus.if.org Git - postgis/commitdiff
more examples of TIN and polyhedral surfaces
authorRegina Obe <lr@pcorp.us>
Sat, 5 Mar 2011 06:07:28 +0000 (06:07 +0000)
committerRegina Obe <lr@pcorp.us>
Sat, 5 Mar 2011 06:07:28 +0000 (06:07 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@6876 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference_accessor.xml
doc/reference_processing.xml

index ad6d9368c39df3dc92cf685ee591032ef042bd1e..ed77e2634ac0c4fa3753925625bee961bacace41 100644 (file)
@@ -499,10 +499,9 @@ LINESTRING(0 0 1,1 1 1,1 2 1,1 1 1,0 0 1)
 
 
          <refsection>
-               <title>Examples</title>
+               <title>Standard Examples</title>
 
-               <programlisting>
---Extracting a subset of points from a 3d multipoint
+               <programlisting>--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 &lt;= 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 &lt;= ST_NumGeometries(the_geom);
-
-
-</programlisting>
+WHERE n &lt;= ST_NumGeometries(the_geom);</programlisting>
+         </refsection>
+         
+<refsection><title>Polyhedral Surfaces, TIN and Triangle Examples</title>
+<programlisting>-- 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))</programlisting>
+    
+<programlisting>-- 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))</programlisting>
          </refsection>
 
          <!-- Optionally add a "See Also" section -->
index ba12fcfe32ddf70525ee2a2418f28a480755fea9..05206aa55b7bf2530087c50a7bf4135d86132123 100644 (file)
@@ -1038,7 +1038,7 @@ MULTIPOINT(-118.6 38.329 6,-118.58 38.38 5)
          </refsection>
 
          <refsection>
-               <title>Examples</title>
+               <title>Standard Examples</title>
        <programlisting>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)</programlisting>
-
-<programlisting>
--- Polyhedral surface example
+</refsection>
+<refsection><title>Polyhedral Surfaces, TIN and Triangle Examples</title>
+<programlisting>-- 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))</programlisting>
+    
+<programlisting>-- 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))
+</programlisting>
          </refsection>
          <refsection>
                <title>See Also</title>