[postgis-tickets] r14931 - Preserve SRID in ST_Expand

Daniel Baston dbaston at gmail.com
Thu Jun 2 17:38:40 PDT 2016


Author: dbaston
Date: 2016-06-02 17:38:40 -0700 (Thu, 02 Jun 2016)
New Revision: 14931

Modified:
   trunk/postgis/lwgeom_functions_basic.c
   trunk/regress/regress.sql
   trunk/regress/regress_expected
Log:
Preserve SRID in ST_Expand

Modified: trunk/postgis/lwgeom_functions_basic.c
===================================================================
--- trunk/postgis/lwgeom_functions_basic.c	2016-06-02 22:47:05 UTC (rev 14930)
+++ trunk/postgis/lwgeom_functions_basic.c	2016-06-03 00:38:40 UTC (rev 14931)
@@ -1564,6 +1564,7 @@
 {
 	GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
 	LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
+	int srid = lwgeom_get_srid(lwgeom);
 	LWPOLY *poly;
 	GSERIALIZED *result;
 	GBOX gbox;
@@ -1610,6 +1611,7 @@
 	}
 
 	lwgeom_add_bbox(lwpoly_as_lwgeom(poly));
+	lwgeom_set_srid(lwpoly_as_lwgeom(poly), srid);
 
 	/* Construct GSERIALIZED  */
 	result = geometry_serialize(lwpoly_as_lwgeom(poly));

Modified: trunk/regress/regress.sql
===================================================================
--- trunk/regress/regress.sql	2016-06-02 22:47:05 UTC (rev 14930)
+++ trunk/regress/regress.sql	2016-06-03 00:38:40 UTC (rev 14931)
@@ -276,6 +276,7 @@
 select '223', ST_Expand('BOX3D(-1 3 5, -1 6 8)'::BOX3D, 1, -1, 7);
 select '224', ST_Expand(null::box2d, 1, 1);
 select '225', ST_Expand('BOX(-2 3, -1 6'::BOX2D, 4, 2);
+select '226', ST_SRID(ST_Expand('SRID=4326;POINT (0 0)'::geometry, 1))=4326;
 
 -- Drop test table
 DROP table test;

Modified: trunk/regress/regress_expected
===================================================================
--- trunk/regress/regress_expected	2016-06-02 22:47:05 UTC (rev 14930)
+++ trunk/regress/regress_expected	2016-06-03 00:38:40 UTC (rev 14931)
@@ -199,3 +199,4 @@
 223|BOX3D(-2 4 -2,0 5 15)
 224|
 225|BOX(-6 1,3 8)
+226|t



More information about the postgis-tickets mailing list