Return empty geoms snapped to a grid as immutated (#1089)

Also introduces an "empty" regression test

git-svn-id: http://svn.osgeo.org/postgis/trunk@8408 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2011-12-14 14:37:18 +00:00
parent da780f4405
commit ed841457ad
4 changed files with 9 additions and 2 deletions

View file

@ -530,8 +530,8 @@ Datum LWGEOM_snaptogrid(PG_FUNCTION_ARGS)
/* Do not support gridding Z and M values for now */
grid.ipz=grid.ipm=grid.zsize=grid.msize=0;
/* Return input geometry if grid is null */
if ( grid_isNull(&grid) )
/* Return input geometry if grid is null or input geometry is empty */
if ( grid_isNull(&grid) || gserialized_is_empty(in_geom) )
{
PG_RETURN_POINTER(in_geom);
}

View file

@ -58,6 +58,7 @@ TESTS = \
snaptogrid \
summary \
affine \
empty \
measures \
long_xact \
ctors \

3
regress/empty.sql Normal file
View file

@ -0,0 +1,3 @@
SELECT 'T1.1', ST_AsEWKT(ST_SnapToGrid('POINT EMPTY', 1));
SELECT 'T1.2', ST_AsEWKT(ST_SnapToGrid('LINESTRING EMPTY', 1));
SELECT 'T1.3', ST_AsEWKT(ST_SnapToGrid('SRID=4326;POLYGON EMPTY', 1));

3
regress/empty_expected Normal file
View file

@ -0,0 +1,3 @@
T1.1|POINT EMPTY
T1.2|LINESTRING EMPTY
T1.3|SRID=4326;POLYGON EMPTY