]> granicus.if.org Git - postgis/commitdiff
Remove SFCGAL 2D overlay functions.
authorDarafei Praliaskouski <me@komzpa.net>
Tue, 4 Dec 2018 19:39:28 +0000 (19:39 +0000)
committerDarafei Praliaskouski <me@komzpa.net>
Tue, 4 Dec 2018 19:39:28 +0000 (19:39 +0000)
References #4258
Closes https://github.com/postgis/postgis/pull/350

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

NEWS
doc/reference_processing.xml
postgis/legacy.sql.in
postgis/lwgeom_backend_api.c
postgis/lwgeom_geos.c
postgis/lwgeom_sfcgal.c
postgis/postgis.sql.in
postgis/postgis_legacy.c
regress/sfcgal/regress_ogc_expected
regress/sfcgal/tickets_expected

diff --git a/NEWS b/NEWS
index 04af615f93b91fe1b4bc6e4e80cb685d4d504034..5f48ce35f4ae61e2a8d200165467c9742d7e093d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ PostGIS 3.0.0
   - #4260, liblwgeom headers are not installed anymore.
            If your project depends on them available, please use
            librttopo instead. (Darafei Praliaskouski)
+  - #4258, Remove SFCGAL support for ST_Area, ST_Distance, ST_Intersection,
+           ST_Difference, ST_Union (Darafei Praliaskouski)
 
 * New Features *
   - #2902, postgis_geos_noop (Sandro Santilli)
@@ -51,7 +53,6 @@ PostGIS 3.0.0
   - #4139, Make mixed-dimension ND index build tree correctly (Darafei Praliaskouski,
            Arthur Lesuisse, Andrew Gierth, Raúl Marín)
   - #4262, Document MULTISURFACE compatibility of ST_LineToCurve (Steven Ottens)
-  - #4258, Remove SFCGAL support for ST_Area, ST_Distance (Darafei Praliaskouski)
 
 PostGIS 2.5.0
 2018/09/23
index 3a562c9af7ef48712d872da5944d4092f51a2d70..96dba16ddc20d9b2accc96a8c67bd7cb27e37840 100644 (file)
@@ -1241,12 +1241,10 @@ GEOMETRYCOLLECTION Z (POLYGON Z ((14 14 10,20 10 150,34 6 25,14 14 10))
                <para>Returns a geometry that represents that part of geometry A
                        that does not intersect with geometry B.  One can think of this as GeometryA - ST_Intersection(A,B).  If A is completely contained in B
                        then an empty geometry collection is returned.</para>
-               <note><para>Note - order matters. B - A will always return a portion of B</para></note>
+               <note><para>Order matters. B - A will always return a portion of B</para></note>
 
                <para>Performed by the GEOS module</para>
 
-               <note><para>Do not call with a GeometryCollection as an argument</para></note>
-
                <para>&sfs_compliant; s2.1.1.3</para>
                <para>&sqlmm_compliant; SQL-MM 3: 5.1.20</para>
                <para>&Z_support; However it seems to only consider x y when
@@ -1287,12 +1285,11 @@ GEOMETRYCOLLECTION Z (POLYGON Z ((14 14 10,20 10 150,34 6 25,14 14 10))
                </tbody>
        </tgroup>
 </informaltable>
-<programlisting>
---Safe for 2d. This is same geometries as what is shown for st_symdifference
-SELECT ST_AsText(
+<para>Safe for 2D. This is same geometries as what is shown for st_symdifference</para>
+<programlisting>SELECT ST_AsText(
        ST_Difference(
-                       ST_GeomFromText('LINESTRING(50 100, 50 200)'),
-                       ST_GeomFromText('LINESTRING(50 50, 50 150)')
+                       'LINESTRING(50 100, 50 200)'::geometry,
+                       'LINESTRING(50 50, 50 150)'::geometry
                )
        );
 
@@ -1301,21 +1298,22 @@ st_astext
 LINESTRING(50 150,50 200)
 </programlisting>
 
-<programlisting>
-
---When used in 3d doesn't quite do the right thing
-SELECT ST_AsEWKT(ST_Difference(ST_GeomFromEWKT('MULTIPOINT(-118.58 38.38 5,-118.60 38.329 6,-118.614 38.281 7)'), ST_GeomFromEWKT('POINT(-118.614 38.281 5)')));
+<para>When used in 3d doesn't quite do the right thing.</para>
+<programlisting>select ST_AsEWKT(
+           ST_Difference(
+               'MULTIPOINT(-118.58 38.38 5,-118.60 38.329 6,-118.614 38.281 7)' :: geometry,
+               'POINT(-118.614 38.281 5)' :: geometry
+               )
+    );
 st_asewkt
 ---------
-MULTIPOINT(-118.6 38.329 6,-118.58 38.38 5)
-               </programlisting>
+MULTIPOINT(-118.6 38.329 6,-118.58 38.38 5)</programlisting>
          </refsection>
 
-         <!-- Optionally add a "See Also" section -->
          <refsection>
                <title>See Also</title>
 
-               <para><xref linkend="ST_SymDifference" /></para>
+               <para><xref linkend="ST_SymDifference" />, <xref linkend="ST_Intersection" />, <xref linkend="ST_Union" /></para>
          </refsection>
        </refentry>
 
@@ -1887,18 +1885,15 @@ Returns a geometry that represents the shared portion of geomA and geomB.
 
                        <note><para>Geography: For geography this is really a thin wrapper around the geometry implementation. It first determines the best SRID that
                                        fits the bounding box of the 2 geography objects (if geography objects are within one half zone UTM but not same UTM will pick one of those) (favoring UTM or Lambert Azimuthal Equal Area (LAEA) north/south pole, and falling back on mercator in worst case scenario)  and then intersection in that best fit planar spatial ref and retransforms back to WGS84 geography.</para></note>
-                 <important>
-                       <para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
-                 </important>
 
                <warning><para>This function will drop the M coordinate values if present.</para></warning>
 
-                 <warning><para>If working with 3D geometries, you may want to use SFGCAL based <xref linkend="ST_3DIntersection" /> which does a proper 3D intersection for 3D geometries.  Although this function works with Z-coordinate, it does an averaging of Z-Coordinate values when <code>postgis.backend=geos</code>. <code>postgis.backend=sfcgal</code>, it will return a 2D geometry regardless ignoring the Z-Coordinate. Refer to <xref linkend="postgis_backend" /> for details.</para></warning>
+                 <warning><para>If working with 3D geometries, you may want to use SFGCAL based <xref linkend="ST_3DIntersection" /> which does a proper 3D intersection for 3D geometries.  Although this function works with Z-coordinate, it does an averaging of Z-Coordinate.</para></warning>
 
                  <para>Performed by the GEOS module</para>
-                  <para>&sfcgal_enhanced;</para>
 
                  <para>Availability: 1.5 support for geography data type was introduced.</para>
+                       <para>Changed: 3.0.0 does not depend on SFCGAL.</para>
 
                  <para>&sfs_compliant; s2.1.1.3</para>
                  <para>&sqlmm_compliant; SQL-MM 3: 5.1.18</para>
@@ -1909,45 +1904,42 @@ Returns a geometry that represents the shared portion of geomA and geomB.
  st_astext
 ---------------
 GEOMETRYCOLLECTION EMPTY
-(1 row)
+
 SELECT ST_AsText(ST_Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 0 0, 0 2 )'::geometry));
  st_astext
 ---------------
-POINT(0 0)
-(1 row)
-
----Clip all lines (trails) by country (here we assume country geom are POLYGON or MULTIPOLYGONS)
--- NOTE: we are only keeping intersections that result in a LINESTRING or MULTILINESTRING because we don't
--- care about trails that just share a point
--- the dump is needed to expand a geometry collection into individual single MULT* parts
--- the below is fairly generic and will work for polys, etc. by just changing the where clause
-SELECT clipped.gid, clipped.f_name, clipped_geom
-FROM (SELECT trails.gid, trails.f_name, (ST_Dump(ST_Intersection(country.the_geom, trails.the_geom))).geom As clipped_geom
-FROM country
-       INNER JOIN trails
-       ON ST_Intersects(country.the_geom, trails.the_geom))  As clipped
-       WHERE ST_Dimension(clipped.clipped_geom) = 1 ;
-
---For polys e.g. polygon landmarks, you can also use the sometimes faster hack that buffering anything by 0.0
--- except a polygon results in an empty geometry collection
---(so a geometry collection containing polys, lines and points)
--- buffered by 0.0 would only leave the polygons and dissolve the collection shell
-SELECT poly.gid,  ST_Multi(ST_Buffer(
-                               ST_Intersection(country.the_geom, poly.the_geom),
-                               0.0)
-                               ) As clipped_geom
-FROM country
-       INNER JOIN poly
-       ON ST_Intersects(country.the_geom, poly.the_geom)
-       WHERE Not ST_IsEmpty(ST_Buffer(ST_Intersection(country.the_geom, poly.the_geom),0.0));
-               </programlisting>
+POINT(0 0)</programlisting>
+<para>
+Clip all lines (trails) by country. Hhere we assume country geom are POLYGON or MULTIPOLYGONS.
+NOTE: we are only keeping intersections that result in a LINESTRING or MULTILINESTRING because we don't
+care about trails that just share a point. The dump is needed to expand a geometry collection into individual single MULT* parts.
+The below is fairly generic and will work for polys, etc. by just changing the where clause.</para>
+<programlisting>select clipped.gid, clipped.f_name, clipped_geom
+from (
+         select trails.gid, trails.f_name,
+             (ST_Dump(ST_Intersection(country.geom, trails.geom))).geom clipped_geom
+         from country
+              inner join trails on ST_Intersects(country.geom, trails.geom)
+     ) as clipped
+where ST_Dimension(clipped.clipped_geom) = 1;</programlisting>
+<para>For polys e.g. polygon landmarks, you can also use the sometimes faster hack that buffering anything by 0.0 except a polygon results in an empty geometry collection.
+(So a geometry collection containing polys, lines and points buffered by 0.0 would only leave the polygons and dissolve the collection shell.)</para>
+<programlisting>select poly.gid,
+    ST_Multi(
+        ST_Buffer(
+            ST_Intersection(country.geom, poly.geom),
+            0.0
+        )
+    ) clipped_geom
+from country
+     inner join poly on ST_Intersects(country.geom, poly.geom)
+where not ST_IsEmpty(ST_Buffer(ST_Intersection(country.geom, poly.geom), 0.0));</programlisting>
                </refsection>
 
                <refsection>
                <title>Examples: 2.5Dish</title>
-               <para>Geos is the default backend if not set. Note this is not a true intersection, compare to the same example using <xref linkend="ST_3DIntersection" />.</para>
+               <para>Note this is not a true intersection, compare to the same example using <xref linkend="ST_3DIntersection" />.</para>
                <programlisting>
-set postgis.backend=geos;
 select ST_AsText(ST_Intersection(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;
@@ -1956,23 +1948,10 @@ from  ST_GeomFromText('LINESTRING Z (2 2 6,1.5 1.5 7,1 1 8,0.5 0.5 8,0 0 10)') A
 ---------------------------------------
  LINESTRING Z (1 1 8,0.5 0.5 8,0 0 10)
                </programlisting>
-
-               <para>If your PostGIS is compiled with sfcgal support, have option of using sfcgal, but note if basically cases down both geometries to 2D before doing intersection
-               and returns the ST_Force2D equivalent result which is a 2D geometry</para>
-               <programlisting>
-set postgis.backend=sfcgal;
-select ST_AsText(ST_Intersection(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
-----------------------------------------------
- MULTILINESTRING((0.5 0.5,0 0),(1 1,0.5 0.5))
-               </programlisting>
          </refsection>
                <refsection>
                        <title>See Also</title>
-                       <para><xref linkend="ST_3DIntersection" />, <xref linkend="ST_Difference"/>, <xref linkend="ST_Dimension"/>, <xref linkend="ST_Dump"/>, <xref linkend="ST_Force2D" />, <xref linkend="ST_SymDifference"/>, <xref linkend="ST_Intersects"/>, <xref linkend="ST_Multi"/></para>
+                       <para><xref linkend="ST_3DIntersection" />,     <xref linkend="ST_Difference"/>, <xref linkend="ST_Union"/>, <xref linkend="ST_Dimension"/>, <xref linkend="ST_Dump"/>, <xref linkend="ST_Force2D" />, <xref linkend="ST_SymDifference"/>, <xref linkend="ST_Intersects"/>, <xref linkend="ST_Multi"/></para>
                </refsection>
        </refentry>
 
@@ -3815,14 +3794,15 @@ SELECT ST_AsText(
                because it tries to dissolve boundaries and reorder geometries to ensure that a constructed Multi* doesn't
                have intersecting regions.</para></note>
 
+               <para>ST_Union will use the faster Cascaded Union algorithm described in <ulink
+               url="http://blog.cleverelephant.ca/2009/01/must-faster-unions-in-postgis-14.html">http://blog.cleverelephant.ca/2009/01/must-faster-unions-in-postgis-14.html</ulink></para>
+
        <para>Performed by the GEOS module.</para>
        <para>NOTE: this function was formerly called GeomUnion(), which
                was renamed from "Union" because UNION is an SQL reserved
                word.</para>
-       <para>Availability: 1.4.0 - ST_Union was enhanced. ST_Union(geomarray) was introduced and also faster aggregate collection in PostgreSQL.  If you are using GEOS 3.1.0+
-               ST_Union will use the faster Cascaded Union algorithm described in
-               <ulink
-               url="http://blog.cleverelephant.ca/2009/01/must-faster-unions-in-postgis-14.html">http://blog.cleverelephant.ca/2009/01/must-faster-unions-in-postgis-14.html</ulink></para>
+       <para>Availability: 1.4.0 - ST_Union was enhanced. ST_Union(geomarray) was introduced and also faster aggregate collection in PostgreSQL.</para>
+       <para>Changed: 3.0.0 does not depend on SFCGAL.</para>
 
        <para>&sfs_compliant; s2.1.1.3</para>
        <note><para>Aggregate version is not explicitly defined in OGC SPEC.</para></note>
@@ -3835,53 +3815,50 @@ SELECT ST_AsText(
                <para>Aggregate example</para>
                        <programlisting>
 SELECT stusps,
-          ST_Multi(ST_Union(f.the_geom)) as singlegeom
-        FROM sometable As f
+          ST_Union(f.geom) as singlegeom
+FROM sometable f
 GROUP BY stusps
                          </programlisting>
                <para>Non-Aggregate example</para>
                        <programlisting>
-SELECT ST_AsText(ST_Union(ST_GeomFromText('POINT(1 2)'),
-       ST_GeomFromText('POINT(-2 3)') ) )
+select ST_AsText(ST_Union('POINT(1 2)' :: geometry, 'POINT(-2 3)' :: geometry))
 
 st_astext
 ----------
 MULTIPOINT(-2 3,1 2)
 
+select ST_AsText(ST_Union('POINT(1 2)' :: geometry, 'POINT(1 2)' :: geometry))
 
-SELECT ST_AsText(ST_Union(ST_GeomFromText('POINT(1 2)'),
-               ST_GeomFromText('POINT(1 2)') ) );
 st_astext
 ----------
-POINT(1 2)
-
---3d example - sort of supports 3d (and with mixed dimensions!)
-SELECT ST_AsEWKT(st_union(the_geom))
-FROM
-(SELECT ST_GeomFromEWKT('POLYGON((-7 4.2,-7.1 4.2,-7.1 4.3,
--7 4.2))') as the_geom
-UNION ALL
-SELECT ST_GeomFromEWKT('POINT(5 5 5)') as the_geom
-UNION ALL
-       SELECT ST_GeomFromEWKT('POINT(-2 3 1)') as the_geom
-UNION ALL
-SELECT ST_GeomFromEWKT('LINESTRING(5 5 5, 10 10 10)') as the_geom ) as foo;
+POINT(1 2)</programlisting>
+<para>3D example - sort of supports 3D (and with mixed dimensions!)</para>
+<programlisting>select ST_AsEWKT(ST_Union(geom))
+from (
+         select 'POLYGON((-7 4.2,-7.1 4.2,-7.1 4.3, -7 4.2))'::geometry geom
+         union all
+         select 'POINT(5 5 5)'::geometry geom
+         union all
+         select 'POINT(-2 3 1)'::geometry geom
+         union all
+         select 'LINESTRING(5 5 5, 10 10 10)'::geometry geom
+     ) as foo;
 
 st_asewkt
 ---------
 GEOMETRYCOLLECTION(POINT(-2 3 1),LINESTRING(5 5 5,10 10 10),POLYGON((-7 4.2 5,-7.1 4.2 5,-7.1 4.3 5,-7 4.2 5)));
-
---3d example not mixing dimensions
-SELECT ST_AsEWKT(st_union(the_geom))
-FROM
-(SELECT ST_GeomFromEWKT('POLYGON((-7 4.2 2,-7.1 4.2 3,-7.1 4.3 2,
--7 4.2 2))') as the_geom
-UNION ALL
-SELECT ST_GeomFromEWKT('POINT(5 5 5)') as the_geom
-UNION ALL
-       SELECT ST_GeomFromEWKT('POINT(-2 3 1)') as the_geom
-UNION ALL
-SELECT ST_GeomFromEWKT('LINESTRING(5 5 5, 10 10 10)') as the_geom ) as foo;
+</programlisting>
+<para>3d example not mixing dimensions</para>
+<programlisting>select ST_AsEWKT(ST_Union(geom))
+from (
+         select 'POLYGON((-7 4.2 2,-7.1 4.2 3,-7.1 4.3 2, -7 4.2 2))'::geometry geom
+         union all
+         select 'POINT(5 5 5)'::geometry geom
+         union all
+         select 'POINT(-2 3 1)'::geometry geom
+         union all
+         select 'LINESTRING(5 5 5, 10 10 10)'::geometry geom
+     ) as foo;
 
 st_asewkt
 ---------
@@ -3901,8 +3878,11 @@ MULTILINESTRING((3 4,4 5),(1 2,3 4))
          <refsection>
                <title>See Also</title>
                <para>
-                       <xref linkend="ST_Collect" />
-                       <xref linkend="ST_UnaryUnion" />
+                       <xref linkend="ST_Collect" />,
+                       <xref linkend="ST_UnaryUnion" />,
+                       <xref linkend="ST_Intersection" />,
+                       <xref linkend="ST_Difference" />
+                       <xref linkend="ST_SymDifference" />
                </para>
          </refsection>
        </refentry>
@@ -3947,7 +3927,7 @@ MULTILINESTRING((3 4,4 5),(1 2,3 4))
 
                <para>&Z_support;</para>
 
-               <para>Availability: 2.0.0 - requires GEOS &gt;= 3.3.0.</para>
+               <para>Availability: 2.0.0</para>
          </refsection>
 
 
index be54571208024c064412fac9edd9fb51b85733b0..254ef11e6f690bd934deacc5ab06e9d4ac549dbe 100644 (file)
@@ -773,7 +773,7 @@ CREATE OR REPLACE FUNCTION distance(geometry,geometry)
 -- Deprecation in 1.2.3
 CREATE OR REPLACE FUNCTION difference(geometry,geometry)
        RETURNS geometry
-       AS 'MODULE_PATHNAME','difference'
+       AS 'MODULE_PATHNAME','ST_Difference'
        LANGUAGE 'c' IMMUTABLE STRICT;
 
 -- Deprecation in 1.2.3
@@ -986,7 +986,7 @@ CREATE OR REPLACE FUNCTION GeometryN(geometry,integer)
 -- Deprecation in 1.2.3
 CREATE OR REPLACE FUNCTION GeomUnion(geometry,geometry)
        RETURNS geometry
-       AS 'MODULE_PATHNAME','geomunion'
+       AS 'MODULE_PATHNAME','ST_Union'
        LANGUAGE 'c' IMMUTABLE STRICT;
 
 -- Availability: 1.5.0  -- replaced with postgis_getbbox
@@ -1109,7 +1109,7 @@ CREATE OR REPLACE FUNCTION InteriorRingN(geometry,integer)
 -- Deprecation in 1.2.3
 CREATE OR REPLACE FUNCTION intersection(geometry,geometry)
        RETURNS geometry
-       AS 'MODULE_PATHNAME','intersection'
+       AS 'MODULE_PATHNAME','ST_Intersection'
        LANGUAGE 'c' IMMUTABLE STRICT;
 
        -- Deprecation in 1.2.3
index 7f3844d2c52f272798b084282da4e60cd5f09b9b..917f4b4b27777aaed33d6a8f1fb036f163b0f72d 100644 (file)
 
 Datum intersects(PG_FUNCTION_ARGS);
 Datum intersects3d(PG_FUNCTION_ARGS);
-Datum intersection(PG_FUNCTION_ARGS);
-Datum difference(PG_FUNCTION_ARGS);
-Datum geomunion(PG_FUNCTION_ARGS);
-Datum area(PG_FUNCTION_ARGS);
-Datum distance(PG_FUNCTION_ARGS);
 Datum distance3d(PG_FUNCTION_ARGS);
-
 Datum intersects3d_dwithin(PG_FUNCTION_ARGS);
 
 struct lwgeom_backend_definition
@@ -52,10 +46,6 @@ struct lwgeom_backend_definition
        const char *name;
        Datum (*intersects_fn)(PG_FUNCTION_ARGS);
        Datum (*intersects3d_fn)(PG_FUNCTION_ARGS);
-       Datum (*intersection_fn)(PG_FUNCTION_ARGS);
-       Datum (*difference_fn)(PG_FUNCTION_ARGS);
-       Datum (*union_fn)(PG_FUNCTION_ARGS);
-       Datum (*distance_fn)(PG_FUNCTION_ARGS);
        Datum (*distance3d_fn)(PG_FUNCTION_ARGS);
 };
 
@@ -68,17 +58,11 @@ struct lwgeom_backend_definition
 struct lwgeom_backend_definition lwgeom_backends[LWGEOM_NUM_BACKENDS] = {{.name = "geos",
                                                                          .intersects_fn = geos_intersects,
                                                                          .intersects3d_fn = intersects3d_dwithin,
-                                                                         .intersection_fn = geos_intersection,
-                                                                         .difference_fn = geos_difference,
-                                                                         .union_fn = geos_geomunion,
                                                                          .distance3d_fn = LWGEOM_mindistance3d},
 #if HAVE_SFCGAL
                                                                         {.name = "sfcgal",
                                                                          .intersects_fn = sfcgal_intersects,
                                                                          .intersects3d_fn = sfcgal_intersects3D,
-                                                                         .intersection_fn = sfcgal_intersection,
-                                                                         .difference_fn = sfcgal_difference,
-                                                                         .union_fn = sfcgal_union,
                                                                          .distance3d_fn = sfcgal_distance3D}
 #endif
 };
@@ -93,9 +77,7 @@ lwgeom_backend_switch(const char *newvalue, __attribute__((__unused__)) void *ex
        int i;
 
        if (!newvalue)
-       {
                return;
-       }
 
        for (i = 0; i < LWGEOM_NUM_BACKENDS; ++i)
        {
@@ -149,15 +131,6 @@ lwgeom_init_backend()
        );
 }
 
-#if 0
-
-backend/utils/misc/guc.h
-int GetNumConfigOptions(void) returns num_guc_variables
-
-backend/utils/misc/guc_tables.h
-struct config_generic ** get_guc_variables(void)
-
-#endif
 
 PG_FUNCTION_INFO_V1(intersects);
 Datum intersects(PG_FUNCTION_ARGS)
@@ -165,24 +138,6 @@ Datum intersects(PG_FUNCTION_ARGS)
        return (*lwgeom_backend->intersects_fn)(fcinfo);
 }
 
-PG_FUNCTION_INFO_V1(intersection);
-Datum intersection(PG_FUNCTION_ARGS)
-{
-       return (*lwgeom_backend->intersection_fn)(fcinfo);
-}
-
-PG_FUNCTION_INFO_V1(difference);
-Datum difference(PG_FUNCTION_ARGS)
-{
-       return (*lwgeom_backend->difference_fn)(fcinfo);
-}
-
-PG_FUNCTION_INFO_V1(geomunion);
-Datum geomunion(PG_FUNCTION_ARGS)
-{
-       return (*lwgeom_backend->union_fn)(fcinfo);
-}
-
 PG_FUNCTION_INFO_V1(distance3d);
 Datum distance3d(PG_FUNCTION_ARGS)
 {
index 0aba1e880639095f6a86a93bfd18c671d98fe8c2..907a4195137ec5a859720835ab181ce9849f444c 100644 (file)
@@ -80,13 +80,13 @@ Datum isvalid(PG_FUNCTION_ARGS);
 Datum isvalidreason(PG_FUNCTION_ARGS);
 Datum isvaliddetail(PG_FUNCTION_ARGS);
 Datum buffer(PG_FUNCTION_ARGS);
-Datum geos_intersection(PG_FUNCTION_ARGS);
+Datum ST_Intersection(PG_FUNCTION_ARGS);
 Datum convexhull(PG_FUNCTION_ARGS);
 Datum topologypreservesimplify(PG_FUNCTION_ARGS);
-Datum geos_difference(PG_FUNCTION_ARGS);
+Datum ST_Difference(PG_FUNCTION_ARGS);
 Datum boundary(PG_FUNCTION_ARGS);
 Datum symdifference(PG_FUNCTION_ARGS);
-Datum geos_geomunion(PG_FUNCTION_ARGS);
+Datum ST_Union(PG_FUNCTION_ARGS);
 Datum issimple(PG_FUNCTION_ARGS);
 Datum isring(PG_FUNCTION_ARGS);
 Datum pointonsurface(PG_FUNCTION_ARGS);
@@ -535,33 +535,26 @@ Datum ST_UnaryUnion(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(result);
 }
 
-/**
- * @example geomunion {@link #geomunion} SELECT ST_Union(
- *      'POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))',
- *      'POLYGON((5 5, 15 5, 15 7, 5 7, 5 5))'
- * );
- *
- */
-PG_FUNCTION_INFO_V1(geos_geomunion);
-Datum geos_geomunion(PG_FUNCTION_ARGS)
+PG_FUNCTION_INFO_V1(ST_Union);
+Datum ST_Union(PG_FUNCTION_ARGS)
 {
        GSERIALIZED *geom1;
        GSERIALIZED *geom2;
        GSERIALIZED *result;
-       LWGEOM *lwgeom1, *lwgeom2, *lwresult ;
+       LWGEOM *lwgeom1, *lwgeom2, *lwresult;
 
        geom1 = PG_GETARG_GSERIALIZED_P(0);
        geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-       lwgeom1 = lwgeom_from_gserialized(geom1) ;
-       lwgeom2 = lwgeom_from_gserialized(geom2) ;
+       lwgeom1 = lwgeom_from_gserialized(geom1);
+       lwgeom2 = lwgeom_from_gserialized(geom2);
 
-       lwresult = lwgeom_union(lwgeom1, lwgeom2) ;
-       result = geometry_serialize(lwresult) ;
+       lwresult = lwgeom_union(lwgeom1, lwgeom2);
+       result = geometry_serialize(lwresult);
 
-       lwgeom_free(lwgeom1) ;
-       lwgeom_free(lwgeom2) ;
-       lwgeom_free(lwresult) ;
+       lwgeom_free(lwgeom1);
+       lwgeom_free(lwgeom2);
+       lwgeom_free(lwresult);
 
        PG_FREE_IF_COPY(geom1, 0);
        PG_FREE_IF_COPY(geom2, 1);
@@ -1174,27 +1167,26 @@ Datum ST_OffsetCurve(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(gser_result);
 }
 
-
-PG_FUNCTION_INFO_V1(geos_intersection);
-Datum geos_intersection(PG_FUNCTION_ARGS)
+PG_FUNCTION_INFO_V1(ST_Intersection);
+Datum ST_Intersection(PG_FUNCTION_ARGS)
 {
        GSERIALIZED *geom1;
        GSERIALIZED *geom2;
        GSERIALIZED *result;
-       LWGEOM *lwgeom1, *lwgeom2, *lwresult ;
+       LWGEOM *lwgeom1, *lwgeom2, *lwresult;
 
        geom1 = PG_GETARG_GSERIALIZED_P(0);
        geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-       lwgeom1 = lwgeom_from_gserialized(geom1) ;
-       lwgeom2 = lwgeom_from_gserialized(geom2) ;
+       lwgeom1 = lwgeom_from_gserialized(geom1);
+       lwgeom2 = lwgeom_from_gserialized(geom2);
 
-       lwresult = lwgeom_intersection(lwgeom1, lwgeom2) ;
-       result = geometry_serialize(lwresult) ;
+       lwresult = lwgeom_intersection(lwgeom1, lwgeom2);
+       result = geometry_serialize(lwresult);
 
-       lwgeom_free(lwgeom1) ;
-       lwgeom_free(lwgeom2) ;
-       lwgeom_free(lwresult) ;
+       lwgeom_free(lwgeom1);
+       lwgeom_free(lwgeom2);
+       lwgeom_free(lwresult);
 
        PG_FREE_IF_COPY(geom1, 0);
        PG_FREE_IF_COPY(geom2, 1);
@@ -1202,31 +1194,26 @@ Datum geos_intersection(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(result);
 }
 
-/**
- * @example difference {@link #difference} - SELECT ST_Difference(
- *      'POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))',
- *     'POLYGON((5 5, 15 5, 15 7, 5 7, 5 5))');
- */
-PG_FUNCTION_INFO_V1(geos_difference);
-Datum geos_difference(PG_FUNCTION_ARGS)
+PG_FUNCTION_INFO_V1(ST_Difference);
+Datum ST_Difference(PG_FUNCTION_ARGS)
 {
        GSERIALIZED *geom1;
        GSERIALIZED *geom2;
        GSERIALIZED *result;
-       LWGEOM *lwgeom1, *lwgeom2, *lwresult ;
+       LWGEOM *lwgeom1, *lwgeom2, *lwresult;
 
        geom1 = PG_GETARG_GSERIALIZED_P(0);
        geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-       lwgeom1 = lwgeom_from_gserialized(geom1) ;
-       lwgeom2 = lwgeom_from_gserialized(geom2) ;
+       lwgeom1 = lwgeom_from_gserialized(geom1);
+       lwgeom2 = lwgeom_from_gserialized(geom2);
 
-       lwresult = lwgeom_difference(lwgeom1, lwgeom2) ;
-       result = geometry_serialize(lwresult) ;
+       lwresult = lwgeom_difference(lwgeom1, lwgeom2);
+       result = geometry_serialize(lwresult);
 
-       lwgeom_free(lwgeom1) ;
-       lwgeom_free(lwgeom2) ;
-       lwgeom_free(lwresult) ;
+       lwgeom_free(lwgeom1);
+       lwgeom_free(lwgeom2);
+       lwgeom_free(lwresult);
 
        PG_FREE_IF_COPY(geom1, 0);
        PG_FREE_IF_COPY(geom2, 1);
index 9b738806651ab6ac96314d45d6ff517771c11b15..c805f2edddad3d6fde0422b9da4a66f9217c19b0 100644 (file)
@@ -38,11 +38,8 @@ Datum sfcgal_distance3D(PG_FUNCTION_ARGS);
 Datum sfcgal_area3D(PG_FUNCTION_ARGS);
 Datum sfcgal_intersects(PG_FUNCTION_ARGS);
 Datum sfcgal_intersects3D(PG_FUNCTION_ARGS);
-Datum sfcgal_intersection(PG_FUNCTION_ARGS);
 Datum sfcgal_intersection3D(PG_FUNCTION_ARGS);
-Datum sfcgal_difference(PG_FUNCTION_ARGS);
 Datum sfcgal_difference3D(PG_FUNCTION_ARGS);
-Datum sfcgal_union(PG_FUNCTION_ARGS);
 Datum sfcgal_union3D(PG_FUNCTION_ARGS);
 Datum sfcgal_volume(PG_FUNCTION_ARGS);
 Datum sfcgal_extrude(PG_FUNCTION_ARGS);
@@ -82,9 +79,8 @@ POSTGIS2SFCGALGeometry(GSERIALIZED *pglwgeom)
        LWGEOM *lwgeom = lwgeom_from_gserialized(pglwgeom);
 
        if (!lwgeom)
-       {
                lwpgerror("POSTGIS2SFCGALGeometry: Unable to deserialize input");
-       }
+
        g = LWGEOM2SFCGAL(lwgeom);
        lwgeom_free(lwgeom);
 
@@ -99,9 +95,8 @@ POSTGIS2SFCGALPreparedGeometry(GSERIALIZED *pglwgeom)
        LWGEOM *lwgeom = lwgeom_from_gserialized(pglwgeom);
 
        if (!lwgeom)
-       {
                lwpgerror("POSTGIS2SFCGALPreparedGeometry: Unable to deserialize input");
-       }
+
        g = LWGEOM2SFCGAL(lwgeom);
 
        lwgeom_free(lwgeom);
@@ -409,34 +404,6 @@ Datum sfcgal_approximate_medial_axis(PG_FUNCTION_ARGS)
 #endif /* POSTGIS_SFCGAL_VERSION >= 12 */
 }
 
-PG_FUNCTION_INFO_V1(sfcgal_intersection);
-Datum sfcgal_intersection(PG_FUNCTION_ARGS)
-{
-       GSERIALIZED *input0, *input1, *output;
-       sfcgal_geometry_t *geom0, *geom1;
-       sfcgal_geometry_t *result;
-       srid_t srid;
-
-       sfcgal_postgis_init();
-
-       input0 = PG_GETARG_GSERIALIZED_P(0);
-       srid = gserialized_get_srid(input0);
-       input1 = PG_GETARG_GSERIALIZED_P(1);
-       geom0 = POSTGIS2SFCGALGeometry(input0);
-       PG_FREE_IF_COPY(input0, 0);
-       geom1 = POSTGIS2SFCGALGeometry(input1);
-       PG_FREE_IF_COPY(input1, 1);
-
-       result = sfcgal_geometry_intersection(geom0, geom1);
-       sfcgal_geometry_delete(geom0);
-       sfcgal_geometry_delete(geom1);
-
-       output = SFCGALGeometry2POSTGIS(result, 0, srid);
-       sfcgal_geometry_delete(result);
-
-       PG_RETURN_POINTER(output);
-}
-
 PG_FUNCTION_INFO_V1(sfcgal_intersection3D);
 Datum sfcgal_intersection3D(PG_FUNCTION_ARGS)
 {
@@ -465,34 +432,6 @@ Datum sfcgal_intersection3D(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(output);
 }
 
-PG_FUNCTION_INFO_V1(sfcgal_difference);
-Datum sfcgal_difference(PG_FUNCTION_ARGS)
-{
-       GSERIALIZED *input0, *input1, *output;
-       sfcgal_geometry_t *geom0, *geom1;
-       sfcgal_geometry_t *result;
-       srid_t srid;
-
-       sfcgal_postgis_init();
-
-       input0 = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
-       srid = gserialized_get_srid(input0);
-       input1 = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
-       geom0 = POSTGIS2SFCGALGeometry(input0);
-       PG_FREE_IF_COPY(input0, 0);
-       geom1 = POSTGIS2SFCGALGeometry(input1);
-       PG_FREE_IF_COPY(input1, 1);
-
-       result = sfcgal_geometry_difference(geom0, geom1);
-       sfcgal_geometry_delete(geom0);
-       sfcgal_geometry_delete(geom1);
-
-       output = SFCGALGeometry2POSTGIS(result, 0, srid);
-       sfcgal_geometry_delete(result);
-
-       PG_RETURN_POINTER(output);
-}
-
 PG_FUNCTION_INFO_V1(sfcgal_difference3D);
 Datum sfcgal_difference3D(PG_FUNCTION_ARGS)
 {
@@ -521,34 +460,6 @@ Datum sfcgal_difference3D(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(output);
 }
 
-PG_FUNCTION_INFO_V1(sfcgal_union);
-Datum sfcgal_union(PG_FUNCTION_ARGS)
-{
-       GSERIALIZED *input0, *input1, *output;
-       sfcgal_geometry_t *geom0, *geom1;
-       sfcgal_geometry_t *result;
-       srid_t srid;
-
-       sfcgal_postgis_init();
-
-       input0 = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
-       srid = gserialized_get_srid(input0);
-       input1 = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
-       geom0 = POSTGIS2SFCGALGeometry(input0);
-       PG_FREE_IF_COPY(input0, 0);
-       geom1 = POSTGIS2SFCGALGeometry(input1);
-       PG_FREE_IF_COPY(input1, 1);
-
-       result = sfcgal_geometry_union(geom0, geom1);
-       sfcgal_geometry_delete(geom0);
-       sfcgal_geometry_delete(geom1);
-
-       output = SFCGALGeometry2POSTGIS(result, 0, srid);
-       sfcgal_geometry_delete(result);
-
-       PG_RETURN_POINTER(output);
-}
-
 PG_FUNCTION_INFO_V1(sfcgal_union3D);
 Datum sfcgal_union3D(PG_FUNCTION_ARGS)
 {
@@ -671,9 +582,8 @@ Datum sfcgal_is_solid(PG_FUNCTION_ARGS)
        LWGEOM *lwgeom = lwgeom_from_gserialized(input);
        PG_FREE_IF_COPY(input, 0);
        if (!lwgeom)
-       {
                elog(ERROR, "sfcgal_is_solid: Unable to deserialize input");
-       }
+
        result = FLAGS_GET_SOLID(lwgeom->flags);
 
        lwgeom_free(lwgeom);
@@ -688,9 +598,7 @@ Datum sfcgal_make_solid(PG_FUNCTION_ARGS)
        GSERIALIZED *input = PG_GETARG_GSERIALIZED_P(0);
        LWGEOM *lwgeom = lwgeom_from_gserialized(input);
        if (!lwgeom)
-       {
                elog(ERROR, "sfcgal_make_solid: Unable to deserialize input");
-       }
 
        FLAGS_SET_SOLID(lwgeom->flags, 1);
 
index edfcfeb51bf2675116549e10e47e252a964306e0..bcbe229bbfc7adff2a26f141e63cb3e806afa082 100644 (file)
@@ -3417,7 +3417,7 @@ CREATE OR REPLACE FUNCTION ST_IsValidTrajectory(geometry)
 -- PostGIS equivalent function: intersection(geom1 geometry, geom2 geometry)
 CREATE OR REPLACE FUNCTION ST_Intersection(geom1 geometry, geom2 geometry)
        RETURNS geometry
-       AS 'MODULE_PATHNAME','intersection'
+       AS 'MODULE_PATHNAME','ST_Intersection'
        LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
        COST 1; -- reset cost, see #3675
 
@@ -3590,7 +3590,7 @@ CREATE OR REPLACE FUNCTION ST_FrechetDistance(geom1 geometry, geom2 geometry, fl
 -- PostGIS equivalent function: difference(geom1 geometry, geom2 geometry)
 CREATE OR REPLACE FUNCTION ST_Difference(geom1 geometry, geom2 geometry)
        RETURNS geometry
-       AS 'MODULE_PATHNAME','difference'
+       AS 'MODULE_PATHNAME','ST_Difference'
        LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
        COST 100; --guessed based on ST_Intersection
 
@@ -3621,7 +3621,7 @@ CREATE OR REPLACE FUNCTION ST_symmetricdifference(geom1 geometry, geom2 geometry
 -- PostGIS equivalent function: GeomUnion(geom1 geometry, geom2 geometry)
 CREATE OR REPLACE FUNCTION ST_Union(geom1 geometry, geom2 geometry)
        RETURNS geometry
-       AS 'MODULE_PATHNAME','geomunion'
+       AS 'MODULE_PATHNAME','ST_Union'
        LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
 
 -- Availability: 2.0.0
index f13a38f91c997872ce1ff8443e2a33fad39da8d9..3bf6c108dbdb42a7cfdb26a8055fc5bdff5dce56 100644 (file)
@@ -55,3 +55,9 @@ POSTGIS_DEPRECATE("3.0.0", area);
 POSTGIS_DEPRECATE("3.0.0", LWGEOM_area_polygon);
 POSTGIS_DEPRECATE("3.0.0", distance);
 POSTGIS_DEPRECATE("3.0.0", LWGEOM_mindistance2d);
+POSTGIS_DEPRECATE("3.0.0", geomunion);
+POSTGIS_DEPRECATE("3.0.0", geos_geomunion);
+POSTGIS_DEPRECATE("3.0.0", intersection);
+POSTGIS_DEPRECATE("3.0.0", geos_intersection);
+POSTGIS_DEPRECATE("3.0.0", difference);
+POSTGIS_DEPRECATE("3.0.0", geos_difference);
index a8cfab4f832f9b6f6b57742a00ad992bf3602c16..5ab5f91e6cbd1b687b12b34577d790ca798627b8 100644 (file)
@@ -89,7 +89,7 @@ NOTICE:  Self-intersection
 isvalid|f
 isvalid|t
 intersection|POINT(0 0)
-difference|MULTILINESTRING((0 -2,0 -10),(0 10,0 2))
+difference|MULTILINESTRING((0 10,0 2),(0 -2,0 -10))
 boundary|MULTILINESTRING((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2))
 symdifference|GEOMETRYCOLLECTION(LINESTRING(2 2,4 4),LINESTRING(10 10,20 20),POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,2 4,2 2,4 2,4 4)))
 issimple|t
index b373c2913cf2f5f4ea5422e0d5133b7515332d9f..c48d70287b2520e6db7aa28959ceb38020ce0967 100644 (file)
@@ -129,7 +129,7 @@ ERROR:  First argument must be a LINESTRING
 #723|POINT(-11.11111 55)
 #804|<gml:Point srsName="urn:ogc:def:crs:EPSG::4326"><gml:pos srsDimension="2">0 0</gml:pos></gml:Point>
 #845|t
-#834|GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(10 0,10 10))
+#834|GEOMETRYCOLLECTION(POINT(0 0 5),LINESTRING(10 10 5,10 0 5))
 #884|1|f
 #884|2|t
 #938|