]> granicus.if.org Git - postgis/commitdiff
Fix WKB output for POINT EMPTY with SRID or higher dims (#1478)
authorSandro Santilli <strk@keybit.net>
Mon, 16 Jan 2012 11:22:27 +0000 (11:22 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 16 Jan 2012 11:22:27 +0000 (11:22 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8835 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwout_wkb.c
regress/tickets.sql
regress/tickets_expected
regress/wkb_expected

index 723ac75ae5b726d292296a4222cf709351ace221..3731a2bc2f18a6c1cd398e973f83c161a4ca8f47 100644 (file)
@@ -287,7 +287,11 @@ static uint8_t* empty_to_wkb_buf(const LWGEOM *geom, uint8_t *buf, uint8_t varia
        uint32_t wkb_type = lwgeom_wkb_type(geom, variant);
 
        if ( geom->type == POINTTYPE )
-               wkb_type = WKB_MULTIPOINT_TYPE; /* Change POINT to MULTIPOINT */
+       {
+               /* Change POINT to MULTIPOINT */
+               wkb_type &= ~WKB_POINT_TYPE;     /* clear POINT flag */
+               wkb_type |= WKB_MULTIPOINT_TYPE; /* set MULTIPOINT flag */
+       }
 
        /* Set the endian flag */
        buf = endian_to_wkb_buf(buf, variant);
index a316f28f5849be377ac52184f2a93a46617e48f3..16173bea583cf1bd5e7a2e8b7f810e5264c7f80d 100644 (file)
@@ -514,6 +514,9 @@ SELECT '#1454', st_orderingequals(g,g) from inp;
 -- #1414
 SELECT '#1414', st_astext(st_force_3dz('CURVEPOLYGON EMPTY'));
 
+-- #1478
+SELECT '#1478', 'SRID=1;POINT EMPTY'::geometry::text::geometry;
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
 
index 14e9788337c80c8c868739691ffdd169f4d6d154..83cbfacd5e32d8bb911f061c302dd4c88d819a33 100644 (file)
@@ -173,3 +173,4 @@ ERROR:  MultiSurface cannot contain MultiPoint element
 #1453.2|f
 #1454|t
 #1414|CURVEPOLYGON Z EMPTY
+#1478|01040000200100000000000000
index 43c3c9b11e433a0fecc7871390a6ce2bfcba2278..d482fa789d9b99e6d6ddb719c31e6f9357da383e 100644 (file)
@@ -1,7 +1,7 @@
 POINT EMPTY|010400000000000000|f|000000000400000000
-POINT Z EMPTY|010400000000000000|f|000000000400000000
-POINT M EMPTY|010400000000000000|f|000000000400000000
-POINT ZM EMPTY|010400000000000000|f|000000000400000000
+POINT Z EMPTY|01ec03000000000000|f|00000003ec00000000
+POINT M EMPTY|01d407000000000000|f|00000007d400000000
+POINT ZM EMPTY|01bc0b000000000000|f|0000000bbc00000000
 POINT(0 0)|010100000000000000000000000000000000000000|t|000000000100000000000000000000000000000000
 POINT Z (1 2 3)|01e9030000000000000000f03f00000000000000400000000000000840|t|00000003e93ff000000000000040000000000000004008000000000000
 POINT M (1 2 3)|01d1070000000000000000f03f00000000000000400000000000000840|t|00000007d13ff000000000000040000000000000004008000000000000