[postgis-tickets] r16607 - Remove mentions of GEOS <= 3.5.0.

Darafei komzpa at gmail.com
Tue Jun 5 05:28:44 PDT 2018


Author: komzpa
Date: 2018-06-05 05:28:44 -0700 (Tue, 05 Jun 2018)
New Revision: 16607

Modified:
   trunk/liblwgeom/cunit/cu_clip_by_rect.c
   trunk/liblwgeom/cunit/cu_geos.c
   trunk/liblwgeom/liblwgeom.h.in
   trunk/liblwgeom/lwgeom_geos.c
   trunk/postgis/lwgeom_dump.c
   trunk/postgis/lwgeom_geos.c
   trunk/postgis/mvt.c
   trunk/postgis/postgis_module.c
   trunk/regress/node.sql
Log:
Remove mentions of GEOS <= 3.5.0.

PostGIS requires 3.5.0 already.

Closes https://github.com/postgis/postgis/pull/255



Modified: trunk/liblwgeom/cunit/cu_clip_by_rect.c
===================================================================
--- trunk/liblwgeom/cunit/cu_clip_by_rect.c	2018-06-03 19:33:23 UTC (rev 16606)
+++ trunk/liblwgeom/cunit/cu_clip_by_rect.c	2018-06-05 12:28:44 UTC (rev 16607)
@@ -18,7 +18,6 @@
 
 static void test_lwgeom_clip_by_rect(void)
 {
-#if POSTGIS_GEOS_VERSION >= 35
 	LWGEOM *in, *out;
 	const char *wkt;
 	char *tmp;
@@ -65,8 +64,6 @@
 	//tmp = lwgeom_to_ewkt(out); printf("%s\n", tmp); lwfree(tmp);
 	CU_ASSERT(lwgeom_is_empty(out));
 	lwgeom_free(out); lwgeom_free(in);
-
-#endif /* POSTGIS_GEOS_VERSION >= 35 */
 }
 
 /*

Modified: trunk/liblwgeom/cunit/cu_geos.c
===================================================================
--- trunk/liblwgeom/cunit/cu_geos.c	2018-06-03 19:33:23 UTC (rev 16606)
+++ trunk/liblwgeom/cunit/cu_geos.c	2018-06-05 12:28:44 UTC (rev 16607)
@@ -130,9 +130,6 @@
 
 static void test_geos_subdivide(void)
 {
-#if POSTGIS_GEOS_VERSION < 35
-	return;
-#else
 	char *ewkt = "LINESTRING(0 0, 10 10)";
 	char *out_ewkt;
 	LWGEOM *geom1 = lwgeom_from_wkt(ewkt, LW_PARSER_CHECK_NONE);
@@ -155,7 +152,6 @@
 
 	lwgeom_free(geom2);
 	lwgeom_free(geom1);
-#endif
 }
 
 /*

Modified: trunk/liblwgeom/liblwgeom.h.in
===================================================================
--- trunk/liblwgeom/liblwgeom.h.in	2018-06-03 19:33:23 UTC (rev 16606)
+++ trunk/liblwgeom/liblwgeom.h.in	2018-06-05 12:28:44 UTC (rev 16607)
@@ -2360,12 +2360,8 @@
  */
 LWGEOM* lwgeom_buildarea(const LWGEOM *geom) ;
 
-
 /**
  * Attempts to make an invalid geometries valid w/out losing points.
- *
- * NOTE: this is only available when liblwgeom is built against
- *       GEOS 3.3.0 or higher
  */
 LWGEOM* lwgeom_make_valid(LWGEOM* geom);
 
@@ -2381,8 +2377,6 @@
 /*
  * Fully node a set of linestrings, using the least nodes preserving
  * all the input ones.
- *
- * Requires GEOS-3.3.0 or higher
  */
 LWGEOM* lwgeom_node(const LWGEOM* lwgeom_in);
 
@@ -2405,8 +2399,6 @@
  * @param tolerance an optional snapping tolerance for improved robustness
  * @param output_edges if non-zero the result will be a MULTILINESTRING,
  *                 otherwise it'll be a COLLECTION of polygons.
- *
- * Requires GEOS-3.5.0 or higher
  */
 LWGEOM* lwgeom_voronoi_diagram(const LWGEOM* g, const GBOX* env, double tolerance, int output_edges);
 
@@ -2420,6 +2412,5 @@
 */
 int * lwgeom_cluster_2d_kmeans(const LWGEOM **geoms, uint32_t ngeoms, uint32_t k);
 
-
 #endif /* !defined _LIBLWGEOM_H  */
 

Modified: trunk/liblwgeom/lwgeom_geos.c
===================================================================
--- trunk/liblwgeom/lwgeom_geos.c	2018-06-03 19:33:23 UTC (rev 16606)
+++ trunk/liblwgeom/lwgeom_geos.c	2018-06-05 12:28:44 UTC (rev 16607)
@@ -1730,10 +1730,6 @@
 LWGEOM*
 lwgeom_delaunay_triangulation(const LWGEOM* geom, double tolerance, int32_t output)
 {
-#if POSTGIS_GEOS_VERSION < 34
-	lwerror("lwgeom_delaunay_triangulation: GEOS 3.4 or higher required");
-	return NULL;
-#else
 	LWGEOM* result;
 	int32_t srid = get_result_srid(geom, NULL, __func__);
 	uint8_t is3d = FLAGS_GET_Z(geom->flags);
@@ -1772,17 +1768,8 @@
 
 	geos_clean(g1, NULL, g3);
 	return result;
-#endif /* POSTGIS_GEOS_VERSION < 34 */
 }
 
-#if POSTGIS_GEOS_VERSION < 35
-LWGEOM*
-lwgeom_voronoi_diagram(const LWGEOM* g, const GBOX* env, double tolerance, int output_edges)
-{
-	lwerror("lwgeom_voronoi_diagram: GEOS 3.5 or higher required");
-	return NULL;
-}
-#else  /* POSTGIS_GEOS_VERSION >= 35 */
 static GEOSCoordSequence*
 lwgeom_get_geos_coordseq_2d(const LWGEOM* g, uint32_t num_points)
 {
@@ -1873,4 +1860,3 @@
 
 	return lwgeom_result;
 }
-#endif /* POSTGIS_GEOS_VERSION >= 35 */

Modified: trunk/postgis/lwgeom_dump.c
===================================================================
--- trunk/postgis/lwgeom_dump.c	2018-06-03 19:33:23 UTC (rev 16606)
+++ trunk/postgis/lwgeom_dump.c	2018-06-05 12:28:44 UTC (rev 16607)
@@ -327,16 +327,6 @@
 PG_FUNCTION_INFO_V1(ST_Subdivide);
 Datum ST_Subdivide(PG_FUNCTION_ARGS)
 {
-#if POSTGIS_GEOS_VERSION < 35
-
-	elog(ERROR, "The GEOS version this PostGIS binary "
-	        "was compiled against (%d) doesn't support "
-	        "'%s' function (3.5.0+ required)",
-	        POSTGIS_GEOS_VERSION, __func__);
-	PG_RETURN_NULL();
-
-#else /* POSTGIS_GEOS_VERSION >= 35 */
-
 	typedef struct
 	{
 		int nextgeom;
@@ -412,7 +402,5 @@
 		/* do when there is no more left */
 		SRF_RETURN_DONE(funcctx);
 	}
-
-#endif /* POSTGIS_GEOS_VERSION >= 35 */
 }
 

Modified: trunk/postgis/lwgeom_geos.c
===================================================================
--- trunk/postgis/lwgeom_geos.c	2018-06-03 19:33:23 UTC (rev 16606)
+++ trunk/postgis/lwgeom_geos.c	2018-06-05 12:28:44 UTC (rev 16607)
@@ -53,13 +53,15 @@
  * Prints error message only if it was not for interruption, in which
  * case we let PostgreSQL deal with the error.
  */
-#define HANDLE_GEOS_ERROR(label) { \
-  if (strstr(lwgeom_geos_errmsg, "InterruptedException")) \
-    ereport(ERROR, (errcode(ERRCODE_QUERY_CANCELED), errmsg("canceling statement due to user request"))); \
-  else \
-    lwpgerror(label ": %s", lwgeom_geos_errmsg); \
-  PG_RETURN_NULL(); \
-}
+#define HANDLE_GEOS_ERROR(label) \
+	{ \
+		if (strstr(lwgeom_geos_errmsg, "InterruptedException")) \
+			ereport(ERROR, \
+				(errcode(ERRCODE_QUERY_CANCELED), errmsg("canceling statement due to user request"))); \
+		else \
+			lwpgerror("%s: %s", (label), lwgeom_geos_errmsg); \
+		PG_RETURN_NULL(); \
+	}
 
 /*
 ** Prototypes for SQL-bound functions
@@ -133,8 +135,8 @@
 	return type == POINTTYPE || type == MULTIPOINTTYPE;
 }
 
-/* utility function that checks a LWPOINT and a GSERIALIZED poly against
- * a cache.  Serialized poly may be a multipart.
+/* Utility function that checks a LWPOINT and a GSERIALIZED poly against a cache.
+ * Serialized poly may be a multipart.
  */
 static int
 pip_short_circuit(RTREE_POLY_CACHE* poly_cache, LWPOINT* point, GSERIALIZED* gpoly)
@@ -164,7 +166,7 @@
 
 /**
  *  @brief Compute the Hausdorff distance thanks to the corresponding GEOS function
- *  @example hausdorffdistance {@link #hausdorffdistance} - SELECT st_hausdorffdistance(
+ *  @example ST_HausdorffDistance {@link #hausdorffdistance} - SELECT ST_HausdorffDistance(
  *      'POLYGON((0 0, 0 2, 1 2, 2 2, 2 0, 0 0))'::geometry,
  *      'POLYGON((0.5 0.5, 0.5 2.5, 1.5 2.5, 2.5 2.5, 2.5 0.5, 0.5 0.5))'::geometry);
  */
@@ -179,8 +181,6 @@
 	double result;
 	int retcode;
 
-	POSTGIS_DEBUG(2, "hausdorff_distance called");
-
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 	geom2 = PG_GETARG_GSERIALIZED_P(1);
 
@@ -197,8 +197,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	retcode = GEOSHausdorffDistance(g1, g2, &result);
@@ -215,9 +214,10 @@
 
 /**
  *  @brief Compute the Hausdorff distance with densification thanks to the corresponding GEOS function
- *  @example hausdorffdistancedensify {@link #hausdorffdistancedensify} - SELECT st_hausdorffdistancedensify(
+ *  @example hausdorffdistancedensify {@link #hausdorffdistancedensify} - SELECT ST_HausdorffDistance(
  *      'POLYGON((0 0, 0 2, 1 2, 2 2, 2 0, 0 0))'::geometry,
- *      'POLYGON((0.5 0.5, 0.5 2.5, 1.5 2.5, 2.5 2.5, 2.5 0.5, 0.5 0.5))'::geometry, 0.5);
+ *      'POLYGON((0.5 0.5, 0.5 2.5, 1.5 2.5, 2.5 2.5, 2.5 0.5, 0.5 0.5))'::geometry,
+ *       0.5);
  */
 
 PG_FUNCTION_INFO_V1(hausdorffdistancedensify);
@@ -231,7 +231,6 @@
 	double result;
 	int retcode;
 
-
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 	geom2 = PG_GETARG_GSERIALIZED_P(1);
 	densifyFrac = PG_GETARG_FLOAT8(2);
@@ -249,8 +248,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	retcode = GEOSHausdorffDistanceDensify(g1, g2, densifyFrac, &result);
@@ -309,8 +307,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	if (densifyFrac <= 0.0)
@@ -345,10 +342,6 @@
 PG_FUNCTION_INFO_V1(pgis_union_geometry_array);
 Datum pgis_union_geometry_array(PG_FUNCTION_ARGS)
 {
-	/*
-	** For GEOS >= 3.3, use the new UnaryUnion functionality to merge the
-	** terminal collection from the ST_Union aggregate
-	*/
 	ArrayType *array;
 
 	ArrayIterator iterator;
@@ -387,9 +380,7 @@
 	while( array_iterate(iterator, &value, &isnull) )
 	{
 		/* Skip null array items */
-		if ( isnull )
-			continue;
-
+		if (isnull) continue;
 		count++;
 	}
 	array_free_iterator(iterator);
@@ -431,9 +422,7 @@
 		GSERIALIZED *gser_in;
 
 		/* Skip null array items */
-		if ( isnull )
-			continue;
-
+		if (isnull) continue;
 		gser_in = (GSERIALIZED *)DatumGetPointer(value);
 
 		/* Check for SRID mismatch in array elements */
@@ -492,10 +481,7 @@
 	if (curgeom > 0)
 	{
 		g = GEOSGeom_createCollection(GEOS_GEOMETRYCOLLECTION, geoms, curgeom);
-		if (!g)
-			HANDLE_GEOS_ERROR(
-			    "Could not create GEOS COLLECTION from geometry "
-			    "array");
+		if (!g) HANDLE_GEOS_ERROR("Could not create GEOS COLLECTION from geometry array");
 
 		g_union = GEOSUnaryUnion(g);
 		GEOSGeom_destroy(g);
@@ -544,7 +530,6 @@
 
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 
-
 	lwgeom1 = lwgeom_from_gserialized(geom1) ;
 
 	lwresult = lwgeom_unaryunion(lwgeom1);
@@ -558,9 +543,8 @@
 	PG_RETURN_POINTER(result);
 }
 
-
 /**
- * @example geomunion {@link #geomunion} SELECT geomunion(
+ * @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))'
  * );
@@ -593,9 +577,8 @@
 	PG_RETURN_POINTER(result);
 }
 
-
 /**
- *  @example symdifference {@link #symdifference} - SELECT symdifference(
+ *  @example symdifference {@link #symdifference} - SELECT ST_SymDifference(
  *      'POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))',
  *      'POLYGON((5 5, 15 5, 15 7, 5 7, 5 5))');
  */
@@ -636,7 +619,6 @@
 	LWGEOM *lwgeom;
 	int srid;
 
-
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
 
 	/* Empty.Boundary() == Empty */
@@ -880,8 +862,7 @@
 			val = strchr(key, '=');
 			if (!val || *(val + 1) == '\0')
 			{
-				lwpgerror("Missing value for buffer "
-				        "parameter %s", key);
+				lwpgerror("Missing value for buffer parameter %s", key);
 				break;
 			}
 			*val = '\0';
@@ -972,19 +953,15 @@
 				}
 				else
 				{
-					lwpgerror("Invalid side "
-					        "parameter: %s (accept: "
-					        "'right', 'left', 'both' "
-					        ")", val);
+					lwpgerror("Invalid side parameter: %s (accept: 'right', 'left', 'both')", val);
 					break;
 				}
 			}
 			else
 			{
-				lwpgerror("Invalid buffer parameter: %s (accept: "
-				        "'endcap', 'join', 'mitre_limit', "
-				        "'miter_limit', 'quad_segs' and "
-				        "'side')", key);
+				lwpgerror(
+				    "Invalid buffer parameter: %s (accept: 'endcap', 'join', 'mitre_limit', 'miter_limit', 'quad_segs' and 'side')",
+				    key);
 				break;
 			}
 		}
@@ -1039,8 +1016,6 @@
 	PG_RETURN_POINTER(result);
 }
 
-
-
 /*
 * Generate a field of random points within the area of a
 * polygon or multipolygon. Throws an error for other geometry
@@ -1059,7 +1034,6 @@
 	gser_input = PG_GETARG_GSERIALIZED_P(0);
 	npoints = DatumGetInt32(DirectFunctionCall1(numeric_int4, PG_GETARG_DATUM(1)));
 
-	/* Smartasses get nothing back */
 	if (npoints < 0)
 		PG_RETURN_NULL();
 
@@ -1114,13 +1088,8 @@
 	gser_input = PG_GETARG_GSERIALIZED_P(0);
 	size = PG_GETARG_FLOAT8(1);
 
-	/*
-	* For distance == 0, just return the input.
-	* Note that due to a bug, GEOS 3.3.0 would return EMPTY.
-	* See http://trac.osgeo.org/geos/ticket/454
-	*/
-	if ( size == 0 )
-		PG_RETURN_POINTER(gser_input);
+	/* For distance == 0, just return the input. */
+	if (size == 0) PG_RETURN_POINTER(gser_input);
 
 	/* Read the lwgeom, check for errors */
 	lwgeom_input = lwgeom_from_gserialized(gser_input);
@@ -1174,8 +1143,9 @@
 				}
 				else
 				{
-					lwpgerror("Invalid buffer end cap style: %s (accept: "
-					        "'round', 'mitre', 'miter' or 'bevel')", val);
+					lwpgerror(
+					    "Invalid buffer end cap style: %s (accept: 'round', 'mitre', 'miter' or 'bevel')",
+					    val);
 					break;
 				}
 			}
@@ -1192,9 +1162,9 @@
 			}
 			else
 			{
-				lwpgerror("Invalid buffer parameter: %s (accept: "
-				        "'join', 'mitre_limit', 'miter_limit and "
-				        "'quad_segs')", key);
+				lwpgerror(
+				    "Invalid buffer parameter: %s (accept: 'join', 'mitre_limit', 'miter_limit and 'quad_segs')",
+				    key);
 				break;
 			}
 		}
@@ -1242,7 +1212,7 @@
 }
 
 /**
- * @example difference {@link #difference} - SELECT difference(
+ * @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))');
  */
@@ -1273,9 +1243,9 @@
 	PG_RETURN_POINTER(result);
 }
 
-
 /**
-	@example pointonsurface - {@link #pointonsurface} SELECT pointonsurface('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))');
+	@example pointonsurface - {@link #pointonsurface} SELECT ST_PointOnSurface('POLYGON((0 0, 10 0, 10 10, 0 10, 0
+   0))');
 */
 PG_FUNCTION_INFO_V1(pointonsurface);
 Datum pointonsurface(PG_FUNCTION_ARGS)
@@ -1302,13 +1272,7 @@
 
 	g1 = POSTGIS2GEOS(geom);
 
-	if (!g1)
-	{
-		/* Why is this a WARNING rather than an error ? */
-		/* TODO: use HANDLE_GEOS_ERROR instead */
-		elog(WARNING, "GEOSPointOnSurface(): %s", lwgeom_geos_errmsg);
-		PG_RETURN_NULL();
-	}
+	if (!g1) HANDLE_GEOS_ERROR(__func__);
 
 	g3 = GEOSPointOnSurface(g1);
 
@@ -1318,8 +1282,6 @@
 		HANDLE_GEOS_ERROR("GEOSPointOnSurface");
 	}
 
-	POSTGIS_DEBUGF(3, "result: %s", GEOSGeomToWKT(g3) ) ;
-
 	GEOSSetSRID(g3, gserialized_get_srid(geom));
 
 	result = GEOS2POSTGIS(g3, gserialized_has_z(geom));
@@ -1414,16 +1376,6 @@
 PG_FUNCTION_INFO_V1(ST_ClipByBox2d);
 Datum ST_ClipByBox2d(PG_FUNCTION_ARGS)
 {
-#if POSTGIS_GEOS_VERSION < 35
-
-	lwpgerror("The GEOS version this PostGIS binary "
-					"was compiled against (%d) doesn't support "
-					"'GEOSClipByRect' function (3.5.0+ required)",
-					POSTGIS_GEOS_VERSION);
-	PG_RETURN_NULL();
-
-#else /* POSTGIS_GEOS_VERSION >= 35 */
-
 	GSERIALIZED *geom1;
 	GSERIALIZED *result;
 	LWGEOM *lwgeom1, *lwresult ;
@@ -1474,15 +1426,11 @@
 	result = geometry_serialize(lwresult) ;
 	lwgeom_free(lwresult) ;
 	PG_RETURN_POINTER(result);
-
-#endif /* POSTGIS_GEOS_VERSION >= 35 */
 }
 
 
-
 /*---------------------------------------------*/
 
-
 /**
  * @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
@@ -1573,10 +1521,6 @@
 	PG_RETURN_BOOL(result);
 }
 
-/*
-** IsValidReason is only available in the GEOS
-** C API > version 3.0
-*/
 PG_FUNCTION_INFO_V1(isvalidreason);
 Datum isvalidreason(PG_FUNCTION_ARGS)
 {
@@ -1607,10 +1551,6 @@
 	PG_RETURN_POINTER(result);
 }
 
-/*
-** IsValidDetail is only available in the GEOS
-** C API >= version 3.3
-*/
 PG_FUNCTION_INFO_V1(isvaliddetail);
 Datum isvaliddetail(PG_FUNCTION_ARGS)
 {
@@ -1658,8 +1598,7 @@
 
 	if ( g1 )
 	{
-		valid = GEOSisValidDetail(g1, flags,
-		                          &geos_reason, &geos_location);
+		valid = GEOSisValidDetail(g1, flags, &geos_reason, &geos_location);
 		GEOSGeom_destroy((GEOSGeometry *)g1);
 		if ( geos_reason )
 		{
@@ -1730,7 +1669,7 @@
 
 	/*
 	 * short-circuit 1: if geom2 bounding box does not overlap
-	 * geom1 bounding box we can prematurely return FALSE.
+	 * geom1 bounding box we can return FALSE.
 	 */
 	if ( gserialized_get_gbox_p(geom1, &box1) &&
 	        gserialized_get_gbox_p(geom2, &box2) )
@@ -1792,15 +1731,12 @@
 
 	/*
 	** short-circuit 1: if geom2 bounding box is not completely inside
-	** geom1 bounding box we can prematurely return FALSE.
+	** geom1 bounding box we can return FALSE.
 	*/
 	if ( gserialized_get_gbox_p(geom1, &box1) &&
 	        gserialized_get_gbox_p(geom2, &box2) )
 	{
-		if ( ! gbox_contains_2d(&box1, &box2) )
-		{
-			PG_RETURN_BOOL(false);
-		}
+		if (!gbox_contains_2d(&box1, &box2)) PG_RETURN_BOOL(false);
 	}
 
 	/*
@@ -1884,16 +1820,11 @@
 	else
 	{
 		g1 = POSTGIS2GEOS(geom1);
-		if (!g1)
-			HANDLE_GEOS_ERROR(
-			    "First argument geometry could not be converted to "
-			    "GEOS");
+		if (!g1) HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 		g2 = POSTGIS2GEOS(geom2);
 		if (!g2)
 		{
-			HANDLE_GEOS_ERROR(
-			    "Second argument geometry could not be converted "
-			    "to GEOS");
+			HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 			GEOSGeom_destroy(g1);
 		}
 		POSTGIS_DEBUG(4, "containsPrepared: cache is not ready, running standard contains");
@@ -1931,9 +1862,9 @@
 		PG_RETURN_BOOL(false);
 
 	/*
-	* short-circuit: if geom2 bounding box is not completely inside
-	* geom1 bounding box we can prematurely return FALSE.
-	*/
+	 * short-circuit: if geom2 bounding box is not completely inside
+	 * geom1 bounding box we can return FALSE.
+	 */
 	if ( gserialized_get_gbox_p(geom1, &box1) &&
 	        gserialized_get_gbox_p(geom2, &box2) )
 	{
@@ -1948,10 +1879,7 @@
 	if ( prep_cache && prep_cache->prepared_geom && prep_cache->gcache.argnum == 1 )
 	{
 		GEOSGeometry *g = POSTGIS2GEOS(geom2);
-		if (!g)
-			HANDLE_GEOS_ERROR(
-			    "First argument geometry could not be converted to "
-			    "GEOS");
+		if (!g) HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 		result = GEOSPreparedContainsProperly( prep_cache->prepared_geom, g);
 		GEOSGeom_destroy(g);
 	}
@@ -1961,17 +1889,12 @@
 		GEOSGeometry *g1;
 
 		g1 = POSTGIS2GEOS(geom1);
-		if (!g1)
-			HANDLE_GEOS_ERROR(
-			    "First argument geometry could not be converted to "
-			    "GEOS");
+		if (!g1) HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 		g2 = POSTGIS2GEOS(geom2);
 		if (!g2)
 		{
 			GEOSGeom_destroy(g1);
-			HANDLE_GEOS_ERROR(
-			    "Second argument geometry could not be converted "
-			    "to GEOS");
+			HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 		}
 		result = GEOSRelatePattern( g1, g2, "T**FF*FF*" );
 		GEOSGeom_destroy(g1);
@@ -2011,7 +1934,7 @@
 
 	/*
 	 * short-circuit 1: if geom2 bounding box is not completely inside
-	 * geom1 bounding box we can prematurely return FALSE.
+	 * geom1 bounding box we can return FALSE.
 	 */
 	if ( gserialized_get_gbox_p(geom1, &box1) &&
 	        gserialized_get_gbox_p(geom2, &box2) )
@@ -2082,10 +2005,7 @@
 	if ( prep_cache && prep_cache->prepared_geom && prep_cache->gcache.argnum == 1 )
 	{
 		GEOSGeometry *g1 = POSTGIS2GEOS(geom2);
-		if (!g1)
-			HANDLE_GEOS_ERROR(
-			    "First argument geometry could not be converted to "
-			    "GEOS");
+		if (!g1) HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 		result = GEOSPreparedCovers( prep_cache->prepared_geom, g1);
 		GEOSGeom_destroy(g1);
 	}
@@ -2095,17 +2015,12 @@
 		GEOSGeometry *g2;
 
 		g1 = POSTGIS2GEOS(geom1);
-		if (!g1)
-			HANDLE_GEOS_ERROR(
-			    "First argument geometry could not be converted to "
-			    "GEOS");
+		if (!g1) HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 		g2 = POSTGIS2GEOS(geom2);
 		if (!g2)
 		{
 			GEOSGeom_destroy(g1);
-			HANDLE_GEOS_ERROR(
-			    "Second argument geometry could not be converted "
-			    "to GEOS");
+			HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 		}
 		result = GEOSRelatePattern( g1, g2, "******FF*" );
 		GEOSGeom_destroy(g1);
@@ -2155,7 +2070,7 @@
 
 	/*
 	 * short-circuit 1: if geom1 bounding box is not completely inside
-	 * geom2 bounding box we can prematurely return FALSE.
+	 * geom2 bounding box we can return FALSE.
 	 */
 	if ( gserialized_get_gbox_p(geom1, &box1) &&
 	        gserialized_get_gbox_p(geom2, &box2) )
@@ -2233,8 +2148,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	result = GEOSRelatePattern(g1,g2,patt);
@@ -2271,7 +2185,7 @@
 
 	/*
 	 * short-circuit 1: if geom2 bounding box does not overlap
-	 * geom1 bounding box we can prematurely return FALSE.
+	 * geom1 bounding box we can return FALSE.
 	 */
 	if ( gserialized_get_gbox_p(geom1, &box1) &&
 	        gserialized_get_gbox_p(geom2, &box2) )
@@ -2292,8 +2206,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	result = GEOSCrosses(g1,g2);
@@ -2330,7 +2243,7 @@
 
 	/*
 	 * short-circuit 1: if geom2 bounding box does not overlap
-	 * geom1 bounding box we can prematurely return FALSE.
+	 * geom1 bounding box we can return FALSE.
 	 */
 	if ( gserialized_get_gbox_p(geom1, &box1) &&
 	        gserialized_get_gbox_p(geom2, &box2) )
@@ -2399,8 +2312,7 @@
 		if ( prep_cache->gcache.argnum == 1 )
 		{
 			GEOSGeometry *g = POSTGIS2GEOS(geom2);
-			if (!g)
-				HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
+			if (!g) HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
 			result = GEOSPreparedIntersects( prep_cache->prepared_geom, g);
 			GEOSGeom_destroy(g);
 		}
@@ -2418,17 +2330,12 @@
 		GEOSGeometry *g1;
 		GEOSGeometry *g2;
 		g1 = POSTGIS2GEOS(geom1);
-		if (!g1)
-			HANDLE_GEOS_ERROR(
-			    "First argument geometry could not be converted to "
-			    "GEOS");
+		if (!g1) HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 		g2 = POSTGIS2GEOS(geom2);
 		if (!g2)
 		{
 			GEOSGeom_destroy(g1);
-			HANDLE_GEOS_ERROR(
-			    "Second argument geometry could not be converted "
-			    "to GEOS");
+			HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 		}
 		result = GEOSIntersects( g1, g2);
 		GEOSGeom_destroy(g1);
@@ -2465,7 +2372,7 @@
 
 	/*
 	 * short-circuit 1: if geom2 bounding box does not overlap
-	 * geom1 bounding box we can prematurely return FALSE.
+	 * geom1 bounding box we can return FALSE.
 	 */
 	if ( gserialized_get_gbox_p(geom1, &box1) &&
 			gserialized_get_gbox_p(geom2, &box2) )
@@ -2486,8 +2393,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	result = GEOSTouches(g1,g2);
@@ -2525,7 +2431,7 @@
 
 	/*
 	 * short-circuit 1: if geom2 bounding box does not overlap
-	 * geom1 bounding box we can prematurely return TRUE.
+	 * geom1 bounding box we can return TRUE.
 	 */
 	if ( gserialized_get_gbox_p(geom1, &box1) &&
 	        gserialized_get_gbox_p(geom2, &box2) )
@@ -2546,8 +2452,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	result = GEOSDisjoint(g1,g2);
@@ -2591,8 +2496,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	patt =  DatumGetCString(DirectFunctionCall1(textout,
@@ -2656,8 +2560,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	POSTGIS_DEBUG(3, "constructed geometries ");
@@ -2734,8 +2637,7 @@
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
-		HANDLE_GEOS_ERROR(
-		    "Second argument geometry could not be converted to GEOS");
+		HANDLE_GEOS_ERROR("Second argument geometry could not be converted to GEOS");
 	}
 
 	result = GEOSEquals(g1,g2);
@@ -2811,10 +2713,6 @@
 	PG_RETURN_BOOL(result);
 }
 
-
-
-
-
 GSERIALIZED *
 GEOS2POSTGIS(GEOSGeom geom, char want3d)
 {
@@ -2830,10 +2728,7 @@
 
 	POSTGIS_DEBUGF(4, "%s: GEOS2LWGEOM returned a %s", __func__, lwgeom_summary(lwgeom, 0));
 
-	if ( lwgeom_needs_bbox(lwgeom) == LW_TRUE )
-	{
-		lwgeom_add_bbox(lwgeom);
-	}
+	if (lwgeom_needs_bbox(lwgeom)) lwgeom_add_bbox(lwgeom);
 
 	result = geometry_serialize(lwgeom);
 	lwgeom_free(lwgeom);
@@ -2856,11 +2751,7 @@
 	}
 	ret = LWGEOM2GEOS(lwgeom, 0);
 	lwgeom_free(lwgeom);
-	if ( ! ret )
-	{
-		/* lwpgerror("POSTGIS2GEOS conversion failed"); */
-		return NULL;
-	}
+
 	return ret;
 }
 
@@ -3497,13 +3388,6 @@
 PG_FUNCTION_INFO_V1(ST_Voronoi);
 Datum ST_Voronoi(PG_FUNCTION_ARGS)
 {
-#if POSTGIS_GEOS_VERSION < 35
-	lwpgerror("The GEOS version this PostGIS binary "
-	        "was compiled against (%d) doesn't support "
-	        "'ST_Voronoi' function (3.5.0+ required)",
-	        POSTGIS_GEOS_VERSION);
-	PG_RETURN_NULL();
-#else /* POSTGIS_GEOS_VERSION >= 35 */
 	GSERIALIZED* input;
 	GSERIALIZED* clip;
 	GSERIALIZED* result;
@@ -3581,8 +3465,6 @@
 
 	PG_FREE_IF_COPY(input, 0);
 	PG_RETURN_POINTER(result);
-
-#endif /* POSTGIS_GEOS_VERSION >= 35 */
 }
 
 /******************************************

Modified: trunk/postgis/mvt.c
===================================================================
--- trunk/postgis/mvt.c	2018-06-03 19:33:23 UTC (rev 16606)
+++ trunk/postgis/mvt.c	2018-06-05 12:28:44 UTC (rev 16607)
@@ -740,13 +740,7 @@
 			double y0 = bgbox.ymin;
 			double x1 = bgbox.xmax;
 			double y1 = bgbox.ymax;
-#if POSTGIS_GEOS_VERSION < 35
-			LWPOLY *lwenv = lwpoly_construct_envelope(0, x0, y0, x1, y1);
-			lwgeom = lwgeom_intersection(lwgeom, lwpoly_as_lwgeom(lwenv));
-			lwpoly_free(lwenv);
-#else
 			lwgeom = lwgeom_clip_by_rect(lwgeom, x0, y0, x1, y1);
-#endif
 			POSTGIS_DEBUG(3, "mvt_geom: no geometry after clip");
 			if (lwgeom == NULL || lwgeom_is_empty(lwgeom))
 				return NULL;

Modified: trunk/postgis/postgis_module.c
===================================================================
--- trunk/postgis/postgis_module.c	2018-06-03 19:33:23 UTC (rev 16606)
+++ trunk/postgis/postgis_module.c	2018-06-05 12:28:44 UTC (rev 16607)
@@ -62,45 +62,10 @@
   coreIntHandler = pqsignal(SIGINT, handleInterrupt);
 
 #ifdef WIN32
-#if POSTGIS_GEOS_VERSION >= 34
   GEOS_interruptRegisterCallback(interruptCallback);
-#endif
   lwgeom_register_interrupt_callback(interruptCallback);
 #endif
 
-#if 0
-  /* Define custom GUC variables. */
-  DefineCustomIntVariable(
-    "postgis.debug.level", /* name */
-    "Sets the debugging level of PostGIS.", /* short_desc */
-    "This is an experimental configuration.", /* long_desc */
-    &postgis_debug_level, /* valueAddr */
-    0, 8, /* min-max */
-    0, /* bootValue */
-    PGC_SUSET, /* GucContext context */
-    GUC_UNIT_MS, /* int flags */
-    NULL, /* GucStringCheckHook check_hook */
-    NULL, /* GucStringAssignHook assign_hook */
-    NULL  /* GucShowHook show_hook */
-   );
-#endif
-
-#if 0
-  /* Define custom GUC variables. */
-  DefineCustomStringVariable(
-    "postgis.greeting.string", /* name */
-    "Sets the greeting string used on postgis module load.", /* short_desc */
-    "This is an experimental configuration.", /* long_desc */
-    &greeting, /* valueAddr */
-    "Welcome to PostGIS " POSTGIS_VERSION, /* bootValue */
-    PGC_SUSET, /* GucContext context */
-    GUC_UNIT_MS, /* int flags */
-    NULL, /* GucStringCheckHook check_hook */
-    NULL, /* GucStringAssignHook assign_hook */
-    NULL  /* GucShowHook show_hook */
-   );
-#endif
-
     /* install PostgreSQL handlers */
     pg_install_lwgeom_handlers();
 
@@ -130,9 +95,7 @@
    */
   /* printf("Interrupt requested\n"); fflush(stdout); */
 
-#if POSTGIS_GEOS_VERSION >= 34
   GEOS_interruptRequest();
-#endif
 
   /* request interruption of liblwgeom as well */
   lwgeom_request_interrupt();

Modified: trunk/regress/node.sql
===================================================================
--- trunk/regress/node.sql	2018-06-03 19:33:23 UTC (rev 16606)
+++ trunk/regress/node.sql	2018-06-05 12:28:44 UTC (rev 16607)
@@ -9,7 +9,6 @@
 ));
 
 -- Node a self-intersecting line
--- NOTE: requires GEOS 3.3.2
 -- See http://trac.osgeo.org/geos/ticket/482
 select 't3', st_asewkt(st_node(
 'SRID=10;LINESTRING(0 0, 10 10, 0 10, 10 0)'



More information about the postgis-tickets mailing list