[postgis-tickets] r14858 - Preserve SRID in ST_MinimumClearanceLine, and add regress checks missed in last commit
Daniel Baston
dbaston at gmail.com
Tue Apr 26 16:17:34 PDT 2016
Author: dbaston
Date: 2016-04-26 16:17:34 -0700 (Tue, 26 Apr 2016)
New Revision: 14858
Added:
trunk/regress/minimum_clearance.sql
trunk/regress/minimum_clearance_expected
Modified:
trunk/postgis/lwgeom_geos.c
Log:
Preserve SRID in ST_MinimumClearanceLine, and add regress checks missed in last commit
Modified: trunk/postgis/lwgeom_geos.c
===================================================================
--- trunk/postgis/lwgeom_geos.c 2016-04-26 18:35:31 UTC (rev 14857)
+++ trunk/postgis/lwgeom_geos.c 2016-04-26 23:17:34 UTC (rev 14858)
@@ -3731,10 +3731,12 @@
GSERIALIZED* result;
GEOSGeometry* input_geos;
GEOSGeometry* result_geos;
+ int srid;
initGEOS(lwpgnotice, lwgeom_geos_error);
input = PG_GETARG_GSERIALIZED_P(0);
+ srid = gserialized_get_srid(input);
input_geos = POSTGIS2GEOS(input);
if (!input_geos) /* exception thrown at construction */
{
@@ -3750,6 +3752,7 @@
PG_RETURN_NULL();
}
+ GEOSSetSRID(result_geos, srid);
result = GEOS2POSTGIS(result_geos, LW_FALSE);
GEOSGeom_destroy(result_geos);
Added: trunk/regress/minimum_clearance.sql
===================================================================
--- trunk/regress/minimum_clearance.sql (rev 0)
+++ trunk/regress/minimum_clearance.sql 2016-04-26 23:17:34 UTC (rev 14858)
@@ -0,0 +1,9 @@
+SELECT 't1', ST_MinimumClearance(NULL::geometry) IS NULL;
+SELECT 't2', ST_MinimumClearanceLine(NULL::geometry) IS NULL;
+SELECT 't3', ST_MinimumClearance('POINT (0 0)') = 'Infinity';
+SELECT 't4', ST_Equals(ST_MinimumClearanceLine('POINT (0 0)'), 'LINESTRING EMPTY');
+SELECT 't5', ST_MinimumClearance('POLYGON ((0 0, 1 0, 1 1, 0.5 3.2e-4, 0 0))')=0.00032;
+SELECT 't6', ST_Equals(ST_MinimumClearanceLine('POLYGON ((0 0, 1 0, 1 1, 0.5 3.2e-4, 0 0))'), 'LINESTRING (0.5 0.00032, 0.5 0)');
+SELECT 't7', ST_MinimumClearance('POLYGON EMPTY') = 'Infinity';
+SELECT 't8', ST_MinimumClearanceLine('POLYGON EMPTY') = 'LINESTRING EMPTY';
+SELECT 't9', ST_SRID(ST_MinimumClearanceLine('SRID=3857;LINESTRING (0 0, 1 1)'))=3857;
Added: trunk/regress/minimum_clearance_expected
===================================================================
--- trunk/regress/minimum_clearance_expected (rev 0)
+++ trunk/regress/minimum_clearance_expected 2016-04-26 23:17:34 UTC (rev 14858)
@@ -0,0 +1,9 @@
+t1|t
+t2|t
+t3|t
+t4|t
+t5|t
+t6|t
+t7|t
+t8|t
+t9|t
More information about the postgis-tickets
mailing list