[postgis-tickets] r17100 - Remove SFCGAL 2D overlay functions.

Darafei komzpa at gmail.com
Tue Dec 4 11:39:28 PST 2018


Author: komzpa
Date: 2018-12-04 11:39:28 -0800 (Tue, 04 Dec 2018)
New Revision: 17100

Modified:
   trunk/NEWS
   trunk/doc/reference_processing.xml
   trunk/postgis/legacy.sql.in
   trunk/postgis/lwgeom_backend_api.c
   trunk/postgis/lwgeom_geos.c
   trunk/postgis/lwgeom_sfcgal.c
   trunk/postgis/postgis.sql.in
   trunk/postgis/postgis_legacy.c
   trunk/regress/sfcgal/regress_ogc_expected
   trunk/regress/sfcgal/tickets_expected
Log:
Remove SFCGAL 2D overlay functions.

References #4258
Closes https://github.com/postgis/postgis/pull/350


Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/NEWS	2018-12-04 19:39:28 UTC (rev 17100)
@@ -13,6 +13,8 @@
   - #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 @@
   - #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

Modified: trunk/doc/reference_processing.xml
===================================================================
--- trunk/doc/reference_processing.xml	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/doc/reference_processing.xml	2018-12-04 19:39:28 UTC (rev 17100)
@@ -1241,12 +1241,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 @@
 		</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 @@
 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 @@
 
 			<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 @@
  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 @@
 ---------------------------------------
  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 @@
 		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,54 +3815,51 @@
 		<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)
+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;
 
---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;
-
 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)));
+</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;
 
---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;
-
 st_asewkt
 ---------
 GEOMETRYCOLLECTION(POINT(-2 3 1),LINESTRING(5 5 5,10 10 10),POLYGON((-7 4.2 2,-7.1 4.2 3,-7.1 4.3 2,-7 4.2 2)))
@@ -3901,8 +3878,11 @@
 	  <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 @@
 
 		<para>&Z_support;</para>
 
-		<para>Availability: 2.0.0 - requires GEOS >= 3.3.0.</para>
+		<para>Availability: 2.0.0</para>
 	  </refsection>
 
 

Modified: trunk/postgis/legacy.sql.in
===================================================================
--- trunk/postgis/legacy.sql.in	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/postgis/legacy.sql.in	2018-12-04 19:39:28 UTC (rev 17100)
@@ -773,7 +773,7 @@
 -- 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 @@
 -- 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 @@
 -- 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

Modified: trunk/postgis/lwgeom_backend_api.c
===================================================================
--- trunk/postgis/lwgeom_backend_api.c	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/postgis/lwgeom_backend_api.c	2018-12-04 19:39:28 UTC (rev 17100)
@@ -38,13 +38,7 @@
 
 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 @@
 	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 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 @@
 	int i;
 
 	if (!newvalue)
-	{
 		return;
-	}
 
 	for (i = 0; i < LWGEOM_NUM_BACKENDS; ++i)
 	{
@@ -149,16 +131,7 @@
 	);
 }
 
-#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 @@
 	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)
 {

Modified: trunk/postgis/lwgeom_geos.c
===================================================================
--- trunk/postgis/lwgeom_geos.c	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/postgis/lwgeom_geos.c	2018-12-04 19:39:28 UTC (rev 17100)
@@ -80,13 +80,13 @@
 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 @@
 	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 @@
 	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 @@
 	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);

Modified: trunk/postgis/lwgeom_sfcgal.c
===================================================================
--- trunk/postgis/lwgeom_sfcgal.c	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/postgis/lwgeom_sfcgal.c	2018-12-04 19:39:28 UTC (rev 17100)
@@ -38,11 +38,8 @@
 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 @@
 	LWGEOM *lwgeom = lwgeom_from_gserialized(pglwgeom);
 
 	if (!lwgeom)
-	{
 		lwpgerror("POSTGIS2SFCGALGeometry: Unable to deserialize input");
-	}
+
 	g = LWGEOM2SFCGAL(lwgeom);
 	lwgeom_free(lwgeom);
 
@@ -99,9 +95,8 @@
 	LWGEOM *lwgeom = lwgeom_from_gserialized(pglwgeom);
 
 	if (!lwgeom)
-	{
 		lwpgerror("POSTGIS2SFCGALPreparedGeometry: Unable to deserialize input");
-	}
+
 	g = LWGEOM2SFCGAL(lwgeom);
 
 	lwgeom_free(lwgeom);
@@ -409,34 +404,6 @@
 #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 @@
 	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 @@
 	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 @@
 	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 @@
 	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);
 

Modified: trunk/postgis/postgis.sql.in
===================================================================
--- trunk/postgis/postgis.sql.in	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/postgis/postgis.sql.in	2018-12-04 19:39:28 UTC (rev 17100)
@@ -3417,7 +3417,7 @@
 -- 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 @@
 -- 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 @@
 -- 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

Modified: trunk/postgis/postgis_legacy.c
===================================================================
--- trunk/postgis/postgis_legacy.c	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/postgis/postgis_legacy.c	2018-12-04 19:39:28 UTC (rev 17100)
@@ -55,3 +55,9 @@
 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);

Modified: trunk/regress/sfcgal/regress_ogc_expected
===================================================================
--- trunk/regress/sfcgal/regress_ogc_expected	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/regress/sfcgal/regress_ogc_expected	2018-12-04 19:39:28 UTC (rev 17100)
@@ -89,7 +89,7 @@
 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

Modified: trunk/regress/sfcgal/tickets_expected
===================================================================
--- trunk/regress/sfcgal/tickets_expected	2018-12-03 22:16:33 UTC (rev 17099)
+++ trunk/regress/sfcgal/tickets_expected	2018-12-04 19:39:28 UTC (rev 17100)
@@ -129,7 +129,7 @@
 #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|



More information about the postgis-tickets mailing list