mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-24 00:52:40 +00:00
more examples of TIN and polyhedral surfaces
git-svn-id: http://svn.osgeo.org/postgis/trunk@6876 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
54e3a46391
commit
244a939935
|
@ -499,10 +499,9 @@ LINESTRING(0 0 1,1 1 1,1 2 1,1 1 1,0 0 1)
|
||||||
|
|
||||||
|
|
||||||
<refsection>
|
<refsection>
|
||||||
<title>Examples</title>
|
<title>Standard Examples</title>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>--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
|
SELECT n, ST_AsEWKT(ST_GeometryN(the_geom, n)) As geomewkt
|
||||||
FROM (
|
FROM (
|
||||||
VALUES (ST_GeomFromEWKT('MULTIPOINT(1 2 7, 3 4 7, 5 6 7, 8 9 10)') ),
|
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)
|
--Extracting all geometries (useful when you want to assign an id)
|
||||||
SELECT gid, n, ST_GeometryN(the_geom, n)
|
SELECT gid, n, ST_GeometryN(the_geom, n)
|
||||||
FROM sometable CROSS JOIN generate_series(1,100) n
|
FROM sometable CROSS JOIN generate_series(1,100) n
|
||||||
WHERE n <= ST_NumGeometries(the_geom);
|
WHERE n <= 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
|
||||||
</programlisting>
|
------------------------------------------
|
||||||
|
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>
|
</refsection>
|
||||||
|
|
||||||
<!-- Optionally add a "See Also" section -->
|
<!-- Optionally add a "See Also" section -->
|
||||||
|
|
|
@ -1038,7 +1038,7 @@ MULTIPOINT(-118.6 38.329 6,-118.58 38.38 5)
|
||||||
</refsection>
|
</refsection>
|
||||||
|
|
||||||
<refsection>
|
<refsection>
|
||||||
<title>Examples</title>
|
<title>Standard Examples</title>
|
||||||
<programlisting>SELECT sometable.field1, sometable.field1,
|
<programlisting>SELECT sometable.field1, sometable.field1,
|
||||||
(ST_Dump(sometable.the_geom)).geom AS the_geom
|
(ST_Dump(sometable.the_geom)).geom AS the_geom
|
||||||
FROM sometable;
|
FROM sometable;
|
||||||
|
@ -1053,9 +1053,9 @@ SELECT ST_AsEWKT(a.geom), ST_HasArc(a.geom)
|
||||||
CIRCULARSTRING(0 0,1 1,1 0) | t
|
CIRCULARSTRING(0 0,1 1,1 0) | t
|
||||||
LINESTRING(1 0,0 1) | f
|
LINESTRING(1 0,0 1) | f
|
||||||
(2 rows)</programlisting>
|
(2 rows)</programlisting>
|
||||||
|
</refsection>
|
||||||
<programlisting>
|
<refsection><title>Polyhedral Surfaces, TIN and Triangle Examples</title>
|
||||||
-- Polyhedral surface example
|
<programlisting>-- Polyhedral surface example
|
||||||
-- Break a Polyhedral surface into its faces
|
-- Break a Polyhedral surface into its faces
|
||||||
SELECT (a.p_geom).path[1] As path, ST_AsEWKT((a.p_geom).geom) As geom_ewkt
|
SELECT (a.p_geom).path[1] As path, ST_AsEWKT((a.p_geom).geom) As geom_ewkt
|
||||||
FROM (SELECT ST_Dump(ST_GeomFromEWKT('POLYHEDRALSURFACE(
|
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))
|
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))
|
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>
|
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>
|
||||||
<refsection>
|
<refsection>
|
||||||
<title>See Also</title>
|
<title>See Also</title>
|
||||||
|
|
Loading…
Reference in a new issue