[postgis-tickets] r17376 - Allow passing GEOMETRYCOLLECTION to GEOS relate functions.

Darafei komzpa at gmail.com
Sat Apr 6 11:40:19 PDT 2019


Author: komzpa
Date: 2019-04-06 23:40:18 -0700 (Sat, 06 Apr 2019)
New Revision: 17376

Modified:
   trunk/NEWS
   trunk/doc/reference_measure.xml
   trunk/doc/reference_processing.xml
   trunk/doc/reference_relationship.xml
   trunk/postgis/lwgeom_geos.c
   trunk/regress/core/tickets.sql
   trunk/regress/core/tickets_expected
Log:
Allow passing GEOMETRYCOLLECTION to GEOS relate functions.

Patch by Esteban Zimányi.

Closes #4295
Closes https://github.com/postgis/postgis/pull/386



Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2019-04-02 16:17:06 UTC (rev 17375)
+++ trunk/NEWS	2019-04-07 06:40:18 UTC (rev 17376)
@@ -85,6 +85,9 @@
            POLYHEDRALSURFACE (Darafei Praliaskouski)
   - #4348, ST_AsMVTGeom (GEOS): Enforce validation at all times (Raúl Marín)
   - #4361, Fix postgis_type_name with (GEOMETRYM,3) (Matt Bretl)
+  - #4295, Allow GEOMETRYCOLLECTION in ST_Overlaps, ST_Contains, ST_ContainsProperly,
+           ST_Covers, ST_CoveredBy, ST_Crosses, ST_Touches, ST_Disjoint, ST_Relate,
+           ST_Equals (Esteban Zimányi)
 
 PostGIS 2.5.0
 2018/09/23

Modified: trunk/doc/reference_measure.xml
===================================================================
--- trunk/doc/reference_measure.xml	2019-04-02 16:17:06 UTC (rev 17375)
+++ trunk/doc/reference_measure.xml	2019-04-07 06:40:18 UTC (rev 17376)
@@ -255,7 +255,7 @@
 		, round(degrees(2*PI()-rad2 -2*PI()+rad1+2*PI()))::int%360 AS reference
 	FROM points ;
 
-1 | line | computed_angle | reference
+1 | line | computed_angle | reference
 ------------------+------------------
 1 | LINESTRING(1.511 1.86,1 1,0.896 0.005) | 155.27033848688 | 155
 
@@ -2116,3 +2116,4 @@
 
 
 </sect1>
+

Modified: trunk/doc/reference_processing.xml
===================================================================
--- trunk/doc/reference_processing.xml	2019-04-02 16:17:06 UTC (rev 17375)
+++ trunk/doc/reference_processing.xml	2019-04-07 06:40:18 UTC (rev 17376)
@@ -3893,9 +3893,6 @@
 			</para>
 
 		<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.21</para>
 		<para>&Z_support; However it seems to only consider x y when

Modified: trunk/doc/reference_relationship.xml
===================================================================
--- trunk/doc/reference_relationship.xml	2019-04-02 16:17:06 UTC (rev 17375)
+++ trunk/doc/reference_relationship.xml	2019-04-07 06:40:18 UTC (rev 17376)
@@ -247,7 +247,7 @@
 		<para>Enhanced: 2.3.0 Enhancement to PIP short-circuit extended to support MultiPoints with few points. Prior versions only supported point in polygon.</para>
 
 		<important>
-		  <para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
 		</important>
 
 		<important>
@@ -435,7 +435,7 @@
 		<para>Availability: 1.4.0</para>
 
 		<important>
-		  <para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
 		</important>
 
 		<important>
@@ -526,7 +526,7 @@
 			Geometry/Geography A</para>
 
 		<important>
-		  <para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
 		</important>
 
 		<important>
@@ -627,7 +627,7 @@
 			Geometry/Geography B</para>
 
 		<important>
-		  <para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
 		</important>
 
 		<important>
@@ -743,9 +743,9 @@
 		Area/Line situations as well. This makes the relation
 		symmetric.</para>
 
-	  <important>
-		<para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
-	  </important>
+		<important>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
+		</important>
 
 	<note>
 	  <para>This function call will automatically include a bounding box
@@ -1060,9 +1060,9 @@
 				returns true, then the geometries are not spatially disjoint.
 				Disjoint implies false for spatial intersection.</para>
 
-			<important>
-				<para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
-			</important>
+		<important>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
+		</important>
 
 			<para>Performed by the GEOS module</para>
 			<note>
@@ -1316,9 +1316,9 @@
 		  <para>This function will return false if either geometry is invalid except in the case where they are binary equal.</para>
 		</important>
 
-        <important>
-            <para>Do not call with a GEOMETRYCOLLECTION as an argument.</para>
- 		</important>
+		<important>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
+		</important>
 
 		<para>&sfs_compliant; s2.1.1.2</para>
 		<para>&sqlmm_compliant; SQL-MM 3: 5.1.24</para>
@@ -1542,7 +1542,9 @@
 
 		 <para>Performed by the GEOS module</para>
 
-		<note><para>Do not call with a GeometryCollection as an argument</para></note>
+		<important>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
+		</important>
 
 		<para>This function call will automatically include a bounding box
 		comparison that will make use of any indexes that are available on
@@ -1740,7 +1742,6 @@
 					by the values in the <ulink url="http://en.wikipedia.org/wiki/DE-9IM">DE-9IM matrix pattern</ulink>.</para>
 
 			<para>This is especially useful for testing compound checks of intersection, crosses, etc in one step.</para>
-			<para>Do not call with a GeometryCollection as an argument</para>
 
 			<note><para>This is the "allowable" version that returns a
 			boolean, not an integer.  This is defined in OGC spec</para></note>
@@ -1754,7 +1755,9 @@
 
 			<para>Version 3: same as version 2, but allows to specify a boundary node rule (1:OGC/MOD2, 2:Endpoint, 3:MultivalentEndpoint, 4:MonovalentEndpoint)</para>
 
-			<note><para>Do not call with a GeometryCollection as an argument</para></note>
+			<important>
+			  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
+			</important>
 
 			<para>not in OGC spec, but implied. see s2.1.13.2</para>
 			<para>&sfs_compliant; s2.1.1.2 // s2.1.13.3</para>
@@ -1921,7 +1924,7 @@
 		</itemizedlist>
 
 		<important>
-		  <para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
 		</important>
 
 		<note>
@@ -2055,7 +2058,7 @@
 		<para>Enhanced: 2.3.0 Enhancement to PIP short-circuit for geometry extended to support MultiPoints with few points. Prior versions only supported point in polygon.</para>
 
 		<important>
-		  <para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
+		  <para>Enhanced: 3.0.0 enabled support for <varname>GEOMETRYCOLLECTION</varname></para> 
 		</important>
 
 		<important>

Modified: trunk/postgis/lwgeom_geos.c
===================================================================
--- trunk/postgis/lwgeom_geos.c	2019-04-02 16:17:06 UTC (rev 17375)
+++ trunk/postgis/lwgeom_geos.c	2019-04-07 06:40:18 UTC (rev 17376)
@@ -1337,50 +1337,6 @@
 
 /*---------------------------------------------*/
 
-/**
- * @brief Throws an ereport ERROR if either geometry is a COLLECTIONTYPE.  Additionally
- * 		displays a HINT of the first 80 characters of the WKT representation of the
- * 		problematic geometry so a user knows which parameter and which geometry
- * 		is causing the problem.
- */
-void errorIfGeometryCollection(GSERIALIZED *g1, GSERIALIZED *g2)
-{
-	int t1 = gserialized_get_type(g1);
-	int t2 = gserialized_get_type(g2);
-
-	char *hintmsg;
-	char *hintwkt;
-	size_t hintsz;
-	LWGEOM *lwgeom;
-
-	if ( t1 == COLLECTIONTYPE)
-	{
-		lwgeom = lwgeom_from_gserialized(g1);
-		hintwkt = lwgeom_to_wkt(lwgeom, WKT_SFSQL, DBL_DIG, &hintsz);
-		lwgeom_free(lwgeom);
-		hintmsg = lwmessage_truncate(hintwkt, 0, hintsz-1, 80, 1);
-		ereport(ERROR,
-		        (errmsg("Relate Operation called with a LWGEOMCOLLECTION type.  This is unsupported."),
-		         errhint("Change argument 1: '%s'", hintmsg))
-		       );
-		pfree(hintwkt);
-		pfree(hintmsg);
-	}
-	else if (t2 == COLLECTIONTYPE)
-	{
-		lwgeom = lwgeom_from_gserialized(g2);
-		hintwkt = lwgeom_to_wkt(lwgeom, WKT_SFSQL, DBL_DIG, &hintsz);
-		hintmsg = lwmessage_truncate(hintwkt, 0, hintsz-1, 80, 1);
-		lwgeom_free(lwgeom);
-		ereport(ERROR,
-		        (errmsg("Relate Operation called with a LWGEOMCOLLECTION type.  This is unsupported."),
-		         errhint("Change argument 2: '%s'", hintmsg))
-		       );
-		pfree(hintwkt);
-		pfree(hintmsg);
-	}
-}
-
 PG_FUNCTION_INFO_V1(isvalid);
 Datum isvalid(PG_FUNCTION_ARGS)
 {
@@ -1562,7 +1518,6 @@
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 	geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	/* A.Overlaps(Empty) == FALSE */
@@ -1619,7 +1574,6 @@
 	GBOX box1, box2;
 	PrepGeomCache *prep_cache;
 
-	errorIfGeometryCollection(geom1, geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	/* A.Contains(Empty) == FALSE */
@@ -1760,7 +1714,6 @@
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 	geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	/* A.ContainsProperly(Empty) == FALSE */
@@ -1835,7 +1788,6 @@
 	if ( gserialized_is_empty(geom1) || gserialized_is_empty(geom2) )
 		PG_RETURN_BOOL(false);
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	/*
@@ -1967,7 +1919,6 @@
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 	geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	/* A.CoveredBy(Empty) == FALSE */
@@ -2082,7 +2033,6 @@
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 	geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	/* A.Crosses(Empty) == FALSE */
@@ -2266,7 +2216,6 @@
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 	geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	/* A.Touches(Empty) == FALSE */
@@ -2325,7 +2274,6 @@
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 	geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	/* A.Disjoint(Empty) == TRUE */
@@ -2387,7 +2335,6 @@
 
 	/* TODO handle empty */
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
@@ -2451,7 +2398,6 @@
 		bnr = PG_GETARG_INT32(2);
 	}
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
@@ -2500,7 +2446,6 @@
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 	geom2 = PG_GETARG_GSERIALIZED_P(1);
 
-	errorIfGeometryCollection(geom1,geom2);
 	error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
 	/* Empty == Empty */

Modified: trunk/regress/core/tickets.sql
===================================================================
--- trunk/regress/core/tickets.sql	2019-04-02 16:17:06 UTC (rev 17375)
+++ trunk/regress/core/tickets.sql	2019-04-07 06:40:18 UTC (rev 17376)
@@ -1114,6 +1114,118 @@
 ANALYZE bug_4144_table;
 DROP TABLE IF EXISTS bug_4144_table;
 
+--4295
+-- CIP - collection within polygon
+SELECT 'contains210', ST_contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'contains211', ST_contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'contains212', ST_contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'contains213', ST_contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'within210', ST_within('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'within211', ST_within('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'within212', ST_within('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'within213', ST_within('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'containsproperly210', ST_containsproperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'containsproperly211', ST_containsproperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'containsproperly212', ST_containsproperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'containsproperly213', ST_containsproperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'overlaps210', ST_overlaps('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'overlaps211', ST_overlaps('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'overlaps212', ST_overlaps('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'overlaps213', ST_overlaps('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'covers210', ST_covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'covers211', ST_covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'covers212', ST_covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'covers213', ST_covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'coveredby210', ST_coveredby('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'coveredby211', ST_coveredby('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'coveredby212', ST_coveredby('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'coveredby213', ST_coveredby('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'crosses210', ST_crosses('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'crosses211', ST_crosses('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'crosses212', ST_crosses('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'crosses213', ST_crosses('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'touches210', ST_touches('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'touches211', ST_touches('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'touches212', ST_touches('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'touches213', ST_touches('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'disjoint210', ST_disjoint('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'disjoint211', ST_disjoint('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'disjoint212', ST_disjoint('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'disjoint213', ST_disjoint('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'relate210', ST_relate('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry);
+-- CIP - collection on edge of polygon
+SELECT 'relate211', ST_relate('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry);
+-- CIP - collection outside polygon
+SELECT 'relate212', ST_relate('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry);
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'relate213', ST_relate('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry);
+
+-- CIP - collection within polygon
+SELECT 'relate_pattern210', ST_relate('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(5 5),LINESTRING(1 1,2 2))'::geometry, 'FF*FF****');
+-- CIP - collection on edge of polygon
+SELECT 'relate_pattern211', ST_relate('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(10 10), LINESTRING(0 0, 0 10))'::geometry, 'FF*FF****');
+-- CIP - collection outside polygon
+SELECT 'relate_pattern212', ST_relate('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0),LINESTRING(11 5,12 5))'::geometry, 'FF*FF****');
+-- CIP - elements of the collection fully outside and fully inside polygon
+SELECT 'relate_pattern213', ST_relate('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 'GEOMETRYCOLLECTION (POINT(-1 0), LINESTRING(4 4,5 5))'::geometry, 'FF*FF****');
+
+-- equals - element inside polygon
+SELECT 'equals210', ST_equals('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 
+'GEOMETRYCOLLECTION (POLYGON((0 0, 10 0, 10 10, 0 10, 0 0)),LINESTRING(0 2, 0 5))'::geometry);
+-- equals - element on border of polygon
+SELECT 'equals211', ST_equals('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 
+'GEOMETRYCOLLECTION (POLYGON((0 0, 10 0, 10 10, 0 10, 0 0)),MULTIPOINT(0 2, 0 5))'::geometry);
+-- equals - element on border and inside polygon
+SELECT 'equals212', ST_equals('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 
+'GEOMETRYCOLLECTION (POLYGON((0 0, 10 0, 10 10, 0 10, 0 0)),LINESTRING(0 2, 0 5, 5 5))'::geometry);
+SELECT 'equals213', ST_equals('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'::geometry, 
+'GEOMETRYCOLLECTION (POLYGON((0 0, 10 0, 10 10, 0 10, 0 0)),MULTIPOINT(0 2, 5 5))'::geometry);
+
 -- #4299
 SELECT '#4299', ST_Disjoint(ST_GeneratePoints(g, 1000), ST_GeneratePoints(g, 1000))
 FROM (SELECT 'POLYGON((0 0,1 0,1 1,0 1,0 0))'::geometry AS g) AS f;

Modified: trunk/regress/core/tickets_expected
===================================================================
--- trunk/regress/core/tickets_expected	2019-04-02 16:17:06 UTC (rev 17375)
+++ trunk/regress/core/tickets_expected	2019-04-07 06:40:18 UTC (rev 17376)
@@ -336,6 +336,54 @@
 #4089|LINESTRING Z (1 1 1,3 3 1)
 #4081|f|t
 NOTICE:  table "bug_4144_table" does not exist, skipping
+contains210|t
+contains211|f
+contains212|f
+contains213|f
+within210|f
+within211|f
+within212|f
+within213|f
+containsproperly210|t
+containsproperly211|f
+containsproperly212|f
+containsproperly213|f
+overlaps210|f
+overlaps211|f
+overlaps212|f
+overlaps213|f
+covers210|t
+covers211|t
+covers212|f
+covers213|f
+coveredby210|f
+coveredby211|f
+coveredby212|f
+coveredby213|f
+crosses210|f
+crosses211|f
+crosses212|f
+crosses213|t
+touches210|f
+touches211|t
+touches212|f
+touches213|f
+disjoint210|f
+disjoint211|f
+disjoint212|t
+disjoint213|f
+relate210|102FF1FF2
+relate211|FF2101FF2
+relate212|FF2FF1102
+relate213|102FF10F2
+relate_pattern210|f
+relate_pattern211|f
+relate_pattern212|t
+relate_pattern213|f
+equals210|t
+equals211|t
+equals212|t
+equals213|t
 #4299|t
 #4304|t|t|t|t
 ERROR:  BOX3D_construct: args can not be empty points



More information about the postgis-tickets mailing list