]> granicus.if.org Git - postgis/commitdiff
ST_ChaikinSmoothing: also smooth start/end point of polygon by default
authorDarafei Praliaskouski <me@komzpa.net>
Fri, 21 Sep 2018 13:20:50 +0000 (13:20 +0000)
committerDarafei Praliaskouski <me@komzpa.net>
Fri, 21 Sep 2018 13:20:50 +0000 (13:20 +0000)
Closes #4156
Closes https://github.com/postgis/postgis/pull/305

git-svn-id: http://svn.osgeo.org/postgis/trunk@16828 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference_processing.xml
postgis/postgis.sql.in

index dd412603c148bb893ddc416e852aa9de9a42522a..e48e7d8e9cb554fa930ccb21467126dc2f483b86 100644 (file)
@@ -3158,9 +3158,9 @@ LINESTRING(5 2,7 25,10 10)
                <funcsynopsis>
                  <funcprototype>
                        <funcdef>geometry <function>ST_ChaikinSmoothing</function></funcdef>
-                       <paramdef><type>geometry</type> <parameter>geomA</parameter></paramdef>
-                       <paramdef><type>integer</type> <parameter>nIterations</parameter></paramdef>
-                       <paramdef><type>boolean</type> <parameter>preserveEndPoints</parameter></paramdef>
+                       <paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
+                       <paramdef><type>integer</type> <parameter>nIterations = 1</parameter></paramdef>
+                       <paramdef><type>boolean</type> <parameter>preserveEndPoints = false</parameter></paramdef>
                  </funcprototype>
                </funcsynopsis>
          </refsynopsisdiv>
@@ -3173,13 +3173,12 @@ LINESTRING(5 2,7 25,10 10)
         The function puts new vertex points at 1/4 of the line before and after each point and removes the original point.
         To reduce the number of points use one of the simplification functions on the result.
         The new points gets interpolated values for all included dimensions, also z and m.</para>
-
+               <para>Second argument, number of iterations is limited to max 5 iterations</para>
+               <para>Note third argument is only valid for polygons, and will be ignored for linestrings</para>
+               <para>This function handles 3D and the third dimension will affect the result.</para>
                <note><para>Note that returned geometry will get more points than the original.
                 To reduce the number of points again use one of the simplification functions on the result.
                 (see <xref linkend="ST_Simplify" /> and <xref linkend="ST_SimplifyVW" />)</para></note>
-               <note><para>Second argument, number of iterations is limited to max 5 iterations</para></note>
-               <note><para>Note third argument is only valid for polygons, and will be ignored for linestrings</para></note>
-               <note><para>This function handles 3D and the third dimension will affect the result.</para></note>
                <para>Availability: 2.5.0</para>
          </refsection>
 
@@ -3187,14 +3186,13 @@ LINESTRING(5 2,7 25,10 10)
                        <title>Examples</title>
                        <para>A triangle is smoothed</para>
                                <programlisting>
-
 select ST_AsText(ST_ChaikinSmoothing(geom)) smoothed
-FROM (SELECT  'LINESTRING(0 0, 8 8, 0 16)'::geometry geom) As foo;
--result
- smoothed
-------------------------------
-LINESTRING(0 0,6 6,6 10,0 16)
-
+FROM (SELECT  'POLYGON((0 0, 8 8, 0 16, 0 0))'::geometry geom) As foo;
+┌───────────────────────────────────────────┐
+│                 smoothed                  │
+├───────────────────────────────────────────┤
+│ POLYGON((2 2,6 6,6 10,2 14,0 12,0 4,2 2)) │
+└───────────────────────────────────────────┘
                                </programlisting>
                  </refsection>
                  <refsection>
index 12e0b774c925e46ad8a7e459e2d5b5dbf1c94ae6..6afb0352a4fd0d815af73272bffd4f245f63a262 100644 (file)
@@ -3178,7 +3178,7 @@ CREATE OR REPLACE FUNCTION ST_FilterByM(geometry, double precision, double preci
        COST 1; -- reset cost, see #3675
 
 -- Availability: 2.5.0
-CREATE OR REPLACE FUNCTION ST_ChaikinSmoothing(geometry, integer default 1, boolean default true)
+CREATE OR REPLACE FUNCTION ST_ChaikinSmoothing(geometry, integer default 1, boolean default false)
        RETURNS geometry
        AS 'MODULE_PATHNAME', 'LWGEOM_ChaikinSmoothing'
        LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL