mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-24 00:52:40 +00:00
fa96023117
git-svn-id: http://svn.osgeo.org/postgis/trunk@14044 b70326c6-7e19-0410-871a-916f4a2858ee
878 lines
30 KiB
XML
878 lines
30 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<sect1 id="reference_sfcgal">
|
|
<sect1info>
|
|
<abstract>
|
|
<para>
|
|
SFCGAL is a C++ wrapper library around CGAL that provides advanced 2D and 3D functions.
|
|
For robustness, geometry coordinates have an exact rational number representation.
|
|
</para>
|
|
<para>
|
|
Installation instructions of the library can be found on SFCGAL home page <ulink url="http://www.sfcgal.org">http://www.sfcgal.org</ulink>.
|
|
To load the functions create extension postgis_sfcgal.
|
|
</para>
|
|
<para>
|
|
Some SFCGAL functions replace standard ones (ST_Intersects, ST_Intersection, ST_Difference, ST_Union, ST_Area and ST_Distance), to switch between standard functions and SFCGAL function use:
|
|
<programlisting>SET postgis.backend = sfcgal;</programlisting>
|
|
and
|
|
<programlisting>SET postgis.backend = geos;</programlisting>
|
|
|
|
</para>
|
|
</abstract>
|
|
</sect1info>
|
|
<title>SFCGAL Functions</title>
|
|
<refentry id="postgis_sfcgal_version">
|
|
<refnamediv>
|
|
<refname>postgis_sfcgal_version</refname>
|
|
|
|
<refpurpose>Returns the version of SFCGAL in use</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>text <function>postgis_sfcgal_version</function></funcdef>
|
|
<void/>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.1.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
|
|
<refentry id="ST_Extrude">
|
|
<refnamediv>
|
|
<refname>ST_Extrude</refname>
|
|
|
|
<refpurpose>Extrude a surface to a related volume</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry <function>ST_Extrude</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
|
|
<paramdef><type>float</type> <parameter>x</parameter></paramdef>
|
|
<paramdef><type>float</type> <parameter>y</parameter></paramdef>
|
|
<paramdef><type>float</type> <parameter>z</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.1.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
<refsection><title>Examples</title>
|
|
<para>3D images were generated using the PostGIS <xref linkend="ST_AsX3D" /> and rendering in HTML using <ulink url="http://www.x3dom.org">X3Dom HTML Javascript redering library</ulink>.</para>
|
|
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry><para>
|
|
<programlisting>SELECT ST_Buffer(ST_GeomFromText('POINT(100 90)'),
|
|
50, 'quad_segs=2'),0,0,30);</programlisting>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_extrude01.png" />
|
|
</imageobject>
|
|
<caption><para>Original octagon formed from buffering point</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
<entry><para>
|
|
<programlisting>ST_Extrude(ST_Buffer(ST_GeomFromText('POINT(100 90)'),
|
|
50, 'quad_segs=2'),0,0,30);</programlisting>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_extrude02.png" />
|
|
</imageobject>
|
|
<caption><para>Hexagon extruded 30 units along Z produces a PolyhedralSurfaceZ</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
</row>
|
|
|
|
<row>
|
|
<entry><para>
|
|
<programlisting>SELECT ST_GeomFromText('LINESTRING(50 50, 100 90, 95 150)')</programlisting>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_extrude03.png" />
|
|
</imageobject>
|
|
<caption><para>Original linestring</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
<entry><para>
|
|
<programlisting>SELECT ST_Extrude(
|
|
ST_GeomFromText('LINESTRING(50 50, 100 90, 95 150)'),0,0,10));</programlisting>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_extrude04.png" />
|
|
</imageobject>
|
|
<caption><para>LineString Extruded along Z produces a PolyhedralSurfaceZ</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsection>
|
|
<refsection>
|
|
<title>See Also</title>
|
|
|
|
<para><xref linkend="ST_AsX3D" /></para>
|
|
</refsection>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="ST_StraightSkeleton">
|
|
<refnamediv>
|
|
<refname>ST_StraightSkeleton</refname>
|
|
|
|
<refpurpose>Compute a straight skeleton from a geometry</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry <function>ST_StraightSkeleton</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.1.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
<refsection><title>Examples</title>
|
|
<programlisting>SELECT ST_StraightSkeleton(ST_GeomFromText('POLYGON (( 190 190, 10 190, 10 10, 190 10, 190 20, 160 30, 60 30, 60 130, 190 140, 190 190 ))'));</programlisting>
|
|
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry><para><informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_straightskeleton01.png" />
|
|
</imageobject>
|
|
<caption><para>Original polygon</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
<entry><para><informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_straightskeleton02.png" />
|
|
</imageobject>
|
|
<caption><para>Straight Skeleton of polygon</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
<refentry id="ST_ApproximateMedialAxis">
|
|
<refnamediv>
|
|
<refname>ST_ApproximateMedialAxis</refname>
|
|
|
|
<refpurpose>Compute the approximate medial axis of an areal geometry.</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry <function>ST_ApproximateMedialAxis</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>
|
|
Return an approximate medial axis for the areal input based on
|
|
its straight skeleton. Uses an SFCGAL specific API when built against
|
|
a capable version (1.2.0+). Otherwise the function is just a wrapper
|
|
around ST_StraightSkeleton (slower case).
|
|
</para>
|
|
|
|
<para>Availability: 2.2.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
<refsection><title>Examples</title>
|
|
<programlisting>SELECT ST_ApproximateMedialAxis(ST_GeomFromText('POLYGON (( 190 190, 10 190, 10 10, 190 10, 190 20, 160 30, 60 30, 60 130, 190 140, 190 190 ))'));</programlisting>
|
|
|
|
<informaltable>
|
|
<tgroup cols="1">
|
|
<tbody>
|
|
<row>
|
|
<entry><para><informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_approximatemedialaxis01.png" />
|
|
</imageobject>
|
|
<caption><para>A polygon and its approximate medial axis</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsection>
|
|
|
|
<refsection>
|
|
<title>See Also</title>
|
|
|
|
<para><xref linkend="ST_StraightSkeleton" /></para>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
|
|
<refentry id="ST_IsPlanar">
|
|
<refnamediv>
|
|
<refname>ST_IsPlanar</refname>
|
|
|
|
<refpurpose>Check if a surface is or not planar</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>boolean <function>ST_IsPlanar</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.2.0: This was documented in 2.1.0 but got accidentally left out in 2.1 release.</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
|
|
<refentry id="ST_Orientation">
|
|
<refnamediv>
|
|
<refname>ST_Orientation</refname>
|
|
|
|
<refpurpose>Determine surface orientation</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>integer <function>ST_Orientation</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>The function only applies to polygons. It returns -1 if the polygon is counterclockwise oriented and 1 if the polygon is clockwise oriented.</para>
|
|
|
|
<para>Availability: 2.1.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
|
|
<refentry id="ST_ForceLHR">
|
|
<refnamediv>
|
|
<refname>ST_ForceLHR</refname>
|
|
|
|
<refpurpose>Force LHR orientation</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry <function>ST_ForceLHR</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.1.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
<refentry id="ST_MinkowskiSum">
|
|
<refnamediv>
|
|
<refname>ST_MinkowskiSum</refname>
|
|
|
|
<refpurpose>Performs Minkowski sum</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry <function>ST_MinkowskiSum</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
|
|
<paramdef><type>geometry</type> <parameter>geom2</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>This function performs a 2D minkowski sum of a point, line or polygon with a polygon.</para>
|
|
<para>A minkowski sum of two geometries A and B is the set of all points that are the sum of any point in A and B. Minkowski sums are often used in motion planning and computer-aided design. More details on <ulink url="https://en.wikipedia.org/wiki/Minkowski_addition">Wikipedia Minkowski addition</ulink>.</para>
|
|
<para>The first parameter can be any 2D geometry (point, linestring, polygon). If a 3D geometry is passed, it will be converted to 2D by forcing Z to 0, leading to possible cases of invalidity. The second parameter must be a 2D polygon.</para>
|
|
|
|
<para>Implementation utilizes <ulink url="http://doc.cgal.org/latest/Minkowski_sum_2/">CGAL 2D Minkowskisum</ulink>.</para>
|
|
|
|
|
|
<para>Availability: 2.1.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
</refsection>
|
|
|
|
<refsection><title>Examples</title>
|
|
<para>Minkowski Sum of Linestring and circle polygon where Linestring cuts thru the circle</para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry>
|
|
<para>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_minkowskisum01.png" />
|
|
</imageobject>
|
|
<caption><para>Before Summing</para></caption>
|
|
</mediaobject>
|
|
</informalfigure>
|
|
</para>
|
|
</entry>
|
|
<entry>
|
|
<para>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_minkowskisum02.png" />
|
|
</imageobject>
|
|
<caption><para>After summing</para></caption>
|
|
</mediaobject>
|
|
</informalfigure>
|
|
</para>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<programlisting>
|
|
SELECT ST_MinkowskiSum(line, circle))
|
|
FROM (SELECT
|
|
ST_MakeLine(ST_MakePoint(10, 10),ST_MakePoint(100, 100)) As line,
|
|
ST_Buffer(ST_GeomFromText('POINT(50 50)'), 30) As circle) As foo;
|
|
|
|
-- wkt --
|
|
MULTIPOLYGON(((30 59.9999999999999,30.5764415879031 54.1472903395161,32.2836140246614 48.5194970290472,35.0559116309237 43.3328930094119,38.7867965644036 38.7867965644035,43.332893009412 35.0559116309236,48.5194970290474 32.2836140246614,54.1472903395162 30.5764415879031,60.0000000000001 30,65.8527096604839 30.5764415879031,71.4805029709527 32.2836140246614,76.6671069905881 35.0559116309237,81.2132034355964 38.7867965644036,171.213203435596 128.786796564404,174.944088369076 133.332893009412,177.716385975339 138.519497029047,179.423558412097 144.147290339516,180 150,179.423558412097 155.852709660484,177.716385975339 161.480502970953,174.944088369076 166.667106990588,171.213203435596 171.213203435596,166.667106990588 174.944088369076,
|
|
161.480502970953 177.716385975339,155.852709660484 179.423558412097,150 180,144.147290339516 179.423558412097,138.519497029047 177.716385975339,133.332893009412 174.944088369076,128.786796564403 171.213203435596,38.7867965644035 81.2132034355963,35.0559116309236 76.667106990588,32.2836140246614 71.4805029709526,30.5764415879031 65.8527096604838,30 59.9999999999999)))
|
|
</programlisting>
|
|
|
|
<para>Minkowski Sum of a polygon and multipoint</para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry>
|
|
<para>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_minkowskisum03.png" />
|
|
</imageobject>
|
|
<caption><para>Before Summing</para></caption>
|
|
</mediaobject>
|
|
</informalfigure>
|
|
</para>
|
|
</entry>
|
|
<entry>
|
|
<para>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_minkowskisum04.png" />
|
|
</imageobject>
|
|
<caption><para>After summing: polygon is duplicated and translated to position of points</para></caption>
|
|
</mediaobject>
|
|
</informalfigure>
|
|
</para>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<programlisting>SELECT ST_MinkowskiSum(mp, poly)
|
|
FROM (SELECT 'MULTIPOINT(25 50,70 25)'::geometry As mp,
|
|
'POLYGON((130 150, 20 40, 50 60, 125 100, 130 150))'::geometry As poly
|
|
) As foo
|
|
|
|
|
|
-- wkt --
|
|
MULTIPOLYGON(
|
|
((70 115,100 135,175 175,225 225,70 115)),
|
|
((120 65,150 85,225 125,275 175,120 65))
|
|
)
|
|
</programlisting>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
<refentry id="ST_3DIntersection">
|
|
<refnamediv>
|
|
<refname>ST_3DIntersection</refname>
|
|
|
|
<refpurpose>Perform 3D intersection</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry <function>ST_3DIntersection</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
|
|
<paramdef><type>geometry</type> <parameter>geom2</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.1.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
<refsection>
|
|
<title>Examples: 3D linestring and Polygon</title>
|
|
<programlisting> SELECT ST_AsText(ST_3DIntersection(linestring, polygon)) As wkt
|
|
FROM ST_GeomFromText('LINESTRING Z (2 2 6,1.5 1.5 7,1 1 8,0.5 0.5 8,0 0 10)') AS linestring
|
|
CROSS JOIN ST_GeomFromText('POLYGON((0 0 8, 0 1 8, 1 1 8, 1 0 8, 0 0 8))') AS polygon;
|
|
|
|
wkt
|
|
--------------------------------
|
|
LINESTRING Z (1 1 8,0.5 0.5 8)
|
|
</programlisting>
|
|
|
|
<para>Cube (closed Polyhedral Surface) and Polygon Z</para>
|
|
<programlisting>SELECT ST_AsText(ST_3DIntersection(
|
|
ST_GeomFromText('POLYHEDRALSURFACE Z( ((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)) )'),
|
|
'POLYGON Z ((0 0 0, 0 0 0.5, 0 0.5 0.5, 0 0.5 0, 0 0 0))'::geometry))</programlisting>
|
|
<screen>TIN Z (((0 0 0,0 0 0.5,0 0.5 0.5,0 0 0)),((0 0.5 0,0 0 0,0 0.5 0.5,0 0.5 0)))</screen>
|
|
|
|
<para>Intersection of 2 solids that result in volumetric intersection is also a solid (ST_Dimension returns 3)</para>
|
|
<programlisting>SELECT ST_AsText(ST_3DIntersection( ST_Extrude(ST_Buffer('POINT(10 20)'::geometry,10,1),0,0,30),
|
|
ST_Extrude(ST_Buffer('POINT(10 20)'::geometry,10,1),2,0,10) ));</programlisting>
|
|
<screen>POLYHEDRALSURFACE Z (((13.3333333333333 13.3333333333333 10,20 20 0,20 20 10,13.3333333333333 13.3333333333333 10)),
|
|
((20 20 10,16.6666666666667 23.3333333333333 10,13.3333333333333 13.3333333333333 10,20 20 10)),
|
|
((20 20 0,16.6666666666667 23.3333333333333 10,20 20 10,20 20 0)),
|
|
((13.3333333333333 13.3333333333333 10,10 10 0,20 20 0,13.3333333333333 13.3333333333333 10)),
|
|
((16.6666666666667 23.3333333333333 10,12 28 10,13.3333333333333 13.3333333333333 10,16.6666666666667 23.3333333333333 10)),
|
|
((20 20 0,9.99999999999995 30 0,16.6666666666667 23.3333333333333 10,20 20 0)),
|
|
((10 10 0,9.99999999999995 30 0,20 20 0,10 10 0)),((13.3333333333333 13.3333333333333 10,12 12 10,10 10 0,13.3333333333333 13.3333333333333 10)),
|
|
((12 28 10,12 12 10,13.3333333333333 13.3333333333333 10,12 28 10)),
|
|
((16.6666666666667 23.3333333333333 10,9.99999999999995 30 0,12 28 10,16.6666666666667 23.3333333333333 10)),
|
|
((10 10 0,0 20 0,9.99999999999995 30 0,10 10 0)),
|
|
((12 12 10,11 11 10,10 10 0,12 12 10)),((12 28 10,11 11 10,12 12 10,12 28 10)),
|
|
((9.99999999999995 30 0,11 29 10,12 28 10,9.99999999999995 30 0)),((0 20 0,2 20 10,9.99999999999995 30 0,0 20 0)),
|
|
((10 10 0,2 20 10,0 20 0,10 10 0)),((11 11 10,2 20 10,10 10 0,11 11 10)),((12 28 10,11 29 10,11 11 10,12 28 10)),
|
|
((9.99999999999995 30 0,2 20 10,11 29 10,9.99999999999995 30 0)),((11 11 10,11 29 10,2 20 10,11 11 10)))</screen>
|
|
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
<refentry id="ST_3DDifference">
|
|
<refnamediv>
|
|
<refname>ST_3DDifference</refname>
|
|
|
|
<refpurpose>Perform 3D difference</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry <function>ST_3DDifference</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
|
|
<paramdef><type>geometry</type> <parameter>geom2</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.2.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
</refentry>
|
|
|
|
<refentry id="ST_3DUnion">
|
|
<refnamediv>
|
|
<refname>ST_3DUnion</refname>
|
|
|
|
<refpurpose>Perform 3D union</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry <function>ST_3DUnion</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
|
|
<paramdef><type>geometry</type> <parameter>geom2</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.2.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="ST_3DArea">
|
|
<refnamediv>
|
|
<refname>ST_3DArea</refname>
|
|
|
|
<refpurpose>Computes area of 3D surface geometries. Will return 0 for solids.</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>float<function>ST_3DArea</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.1.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
<refsection><title>Examples</title>
|
|
<para>Note: By default a PolyhedralSurface built from WKT is a surface geometry, not solid. It therefore has surface area. Once converted to a solid, no area.</para>
|
|
<programlisting>SELECT ST_3DArea(geom) As cube_surface_area,
|
|
ST_3DArea(ST_MakeSolid(geom)) As solid_surface_area
|
|
FROM (SELECT '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)) )'::geometry) As f(geom);
|
|
|
|
cube_surface_area | solid_surface_area
|
|
-------------------+--------------------
|
|
6 | 0 </programlisting>
|
|
|
|
</refsection>
|
|
<refsection>
|
|
<title>See Also</title>
|
|
|
|
<para><xref linkend="ST_Area" />, <xref linkend="ST_MakeSolid" />, <xref linkend="ST_IsSolid" />, <xref linkend="ST_Area" /></para>
|
|
</refsection>
|
|
</refentry>
|
|
|
|
<refentry id="ST_Tesselate">
|
|
<refnamediv>
|
|
<refname>ST_Tesselate</refname>
|
|
|
|
<refpurpose>Perform surface Tesselation of a polygon or polyhedralsurface and returns as a TIN or collection of TINS</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry <function>ST_Tesselate</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
<para>Takes as input a surface such a MULTI(POLYGON) or POLYHEDRALSURFACE and returns a TIN representation via the process of tesselation using triangles.</para>
|
|
<para>Availability: 2.1.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
<refsection><title>Examples</title>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<tbody>
|
|
<row>
|
|
<entry><para>
|
|
<programlisting>SELECT ST_GeomFromText('POLYHEDRALSURFACE Z( ((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)) )');</programlisting>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_tesselate01.png" />
|
|
</imageobject>
|
|
<caption><para>Original Cube</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
<entry><para>
|
|
<programlisting>SELECT ST_Tesselate(ST_GeomFromText('POLYHEDRALSURFACE Z( ((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)) )'));</programlisting></para>
|
|
<para>ST_AsText output:</para>
|
|
<screen>TIN Z (((0 0 0,0 0 1,0 1 1,0 0 0)),((0 1 0,0 0 0,0 1 1,0 1 0)),
|
|
((0 0 0,0 1 0,1 1 0,0 0 0)),
|
|
((1 0 0,0 0 0,1 1 0,1 0 0)),((0 0 1,1 0 0,1 0 1,0 0 1)),
|
|
((0 0 1,0 0 0,1 0 0,0 0 1)),
|
|
((1 1 0,1 1 1,1 0 1,1 1 0)),((1 0 0,1 1 0,1 0 1,1 0 0)),
|
|
((0 1 0,0 1 1,1 1 1,0 1 0)),((1 1 0,0 1 0,1 1 1,1 1 0)),
|
|
((0 1 1,1 0 1,1 1 1,0 1 1)),((0 1 1,0 0 1,1 0 1,0 1 1)))</screen>
|
|
<para> <informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_tesselate02.png" />
|
|
</imageobject>
|
|
<caption><para>Tesselated Cube with triangles colored</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
</row>
|
|
|
|
<row>
|
|
<entry><para>
|
|
<programlisting>SELECT 'POLYGON (( 10 190, 10 70, 80 70, 80 130, 50 160, 120 160, 120 190, 10 190 ))'::geometry;</programlisting>
|
|
<informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_tesselate03.png" />
|
|
</imageobject>
|
|
<caption><para>Original polygon</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
<entry><para>
|
|
<programlisting>SELECT
|
|
ST_Tesselate('POLYGON (( 10 190, 10 70, 80 70, 80 130, 50 160, 120 160, 120 190, 10 190 ))'::geometry);</programlisting>
|
|
</para>
|
|
<para>ST_AsText output</para>
|
|
<screen>TIN(((80 130,50 160,80 70,80 130)),((50 160,10 190,10 70,50 160)),
|
|
((80 70,50 160,10 70,80 70)),((120 160,120 190,50 160,120 160)),
|
|
((120 190,10 190,50 160,120 190)))</screen>
|
|
<para><informalfigure>
|
|
<mediaobject>
|
|
<imageobject>
|
|
<imagedata fileref="images/st_tesselate04.png" />
|
|
</imageobject>
|
|
<caption><para>Tesselated Polygon</para></caption>
|
|
</mediaobject>
|
|
</informalfigure></para>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
<refentry id="ST_Volume">
|
|
<refnamediv>
|
|
<refname>ST_Volume</refname>
|
|
|
|
<refpurpose>Computes the volume of a 3D solid. If applied to surface (even closed) geometries will return 0.</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>float <function>ST_Volume</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.2.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
<refsection>
|
|
<title>Example</title>
|
|
<para>When closed surfaces are created with WKT, they are treated as areal rather than solid. To make them solid, you need to use <xref linkend="ST_MakeSolid" />.
|
|
Areal geometries have no volume. Here is an example to demonstrate.</para>
|
|
<programlisting>SELECT ST_Volume(geom) As cube_surface_vol,
|
|
ST_Volume(ST_MakeSolid(geom)) As solid_surface_vol
|
|
FROM (SELECT '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)) )'::geometry) As f(geom);
|
|
|
|
cube_surface_vol | solid_surface_vol
|
|
------------------+-------------------
|
|
0 | 1
|
|
</programlisting>
|
|
</refsection>
|
|
|
|
<refsection>
|
|
<title>See Also</title>
|
|
|
|
<para><xref linkend="ST_3DArea" />, <xref linkend="ST_MakeSolid" />, <xref linkend="ST_IsSolid" /></para>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
<refentry id="ST_MakeSolid">
|
|
<refnamediv>
|
|
<refname>ST_MakeSolid</refname>
|
|
|
|
<refpurpose>Cast the geometry into a solid. No check is performed. To obtain a valid solid, the input geometry must be a closed Polyhedral Surface or a closed TIN.</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>geometry<function>ST_MakeSolid</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.2.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
<refentry id="ST_IsSolid">
|
|
<refnamediv>
|
|
<refname>ST_IsSolid</refname>
|
|
|
|
<refpurpose>Test if the geometry is a solid. No validity check is performed.</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>boolean<function>ST_IsSolid</function></funcdef>
|
|
<paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
|
|
<refsection>
|
|
<title>Description</title>
|
|
|
|
<para>Availability: 2.2.0</para>
|
|
<para>&sfcgal_required;</para>
|
|
<para>&Z_support;</para>
|
|
<para>&P_support;</para>
|
|
<para>&T_support;</para>
|
|
</refsection>
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
</sect1>
|