From: Sandro Santilli Date: Mon, 19 Mar 2012 12:07:39 +0000 (+0000) Subject: ST_SnapToGrid: retain type on empty return (#1695) X-Git-Tag: 2.0.0beta4~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8263f680724d515c04305e98dc4cd989704c1cc;p=postgis ST_SnapToGrid: retain type on empty return (#1695) git-svn-id: http://svn.osgeo.org/postgis/trunk@9516 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_functions_analytic.c b/postgis/lwgeom_functions_analytic.c index eee1d740d..3d2f78c51 100644 --- a/postgis/lwgeom_functions_analytic.c +++ b/postgis/lwgeom_functions_analytic.c @@ -473,7 +473,7 @@ lwcollection_grid(LWCOLLECTION *coll, gridspec *grid) if ( g ) geoms[ngeoms++] = g; } - if ( ! ngeoms ) return lwcollection_construct_empty(COLLECTIONTYPE, coll->srid, 0, 0); + if ( ! ngeoms ) return lwcollection_construct_empty(coll->type, coll->srid, 0, 0); return lwcollection_construct(coll->type, coll->srid, NULL, ngeoms, geoms); diff --git a/regress/tickets.sql b/regress/tickets.sql index 4f4c24bbc..5eac147fc 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -628,5 +628,8 @@ WITH inp AS ( SELECT 'POINT(-176 -22)'::geography as p ) SELECT '#1596', ST_Summary(ST_Intersection(a,p)) FROM inp; +-- #1695 +SELECT '#1695', ST_AsEWKT(ST_SnapToGrid('MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)))'::geometry, 20)); + -- Clean up DELETE FROM spatial_ref_sys; diff --git a/regress/tickets_expected b/regress/tickets_expected index 4bd17f237..7a5d15c6a 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -209,3 +209,4 @@ NOTICE: SRID value -1 converted to the officially unknown SRID value 0 #1596.6|public.road_pg.roads_geom SRID changed to 0 #1596.7|0 #1596|Point[BG] +#1695|MULTIPOLYGON EMPTY