[postgis-commits] svn - r3673 - in spike/wktraster: rt_core
rt_pg/test
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Mon Feb 9 10:08:47 PST 2009
Author: strk
Date: 2009-02-09 10:08:47 -0800 (Mon, 09 Feb 2009)
New Revision: 3673
Modified:
spike/wktraster/rt_core/rt_api.c
spike/wktraster/rt_pg/test/bbox.sql
Log:
Fix bug in envelope computation, add test for the failing cases.
Modified: spike/wktraster/rt_core/rt_api.c
===================================================================
--- spike/wktraster/rt_core/rt_api.c 2009-02-09 15:54:54 UTC (rev 3672)
+++ spike/wktraster/rt_core/rt_api.c 2009-02-09 18:08:47 UTC (rev 3673)
@@ -1100,26 +1100,26 @@
/* Upper-left corner (first and last points) */
rt_raster_cell_to_geopoint(ctx, raster,
- 0-raster->ipX, 0-raster->ipY,
+ -0.5, -0.5,
&p4d.x, &p4d.y);
setPoint4d(pts, 0, &p4d);
setPoint4d(pts, 4, &p4d); /* needed for closing it? */
/* Upper-right corner (we go clockwise) */
rt_raster_cell_to_geopoint(ctx, raster,
- raster->width-1+raster->ipX, 0-raster->ipY,
+ raster->width-0.5, -0.5,
&p4d.x, &p4d.y);
setPoint4d(pts, 1, &p4d);
/* Lower-right corner */
rt_raster_cell_to_geopoint(ctx, raster,
- raster->width-1+raster->ipX, raster->height-1+raster->ipY,
+ raster->width-0.5, raster->height-0.5,
&p4d.x, &p4d.y);
setPoint4d(pts, 2, &p4d);
/* Lower-left corner */
rt_raster_cell_to_geopoint(ctx, raster,
- 0-raster->ipX, raster->height-1+raster->ipY,
+ -0.5, raster->height-0.5,
&p4d.x, &p4d.y);
setPoint4d(pts, 3, &p4d);
Modified: spike/wktraster/rt_pg/test/bbox.sql
===================================================================
--- spike/wktraster/rt_pg/test/bbox.sql 2009-02-09 15:54:54 UTC (rev 3672)
+++ spike/wktraster/rt_pg/test/bbox.sql 2009-02-09 18:08:47 UTC (rev 3673)
@@ -36,7 +36,66 @@
,'BOX(-0.5 -1,19.5 59)' -- expected envelope (20x60) == (10*2 x 20*3)
);
+INSERT INTO rt_test_envelope
+VALUES ( 1, '1x1, ip:2.5,2.5 scale:5,5 skew:0,0',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0000' -- nBands (uint16 0)
+||
+'0000000000001440' -- scaleX (float64 5)
+||
+'0000000000001440' -- scaleY (float64 5)
+||
+'0000000000000440' -- ipX (float64 2.5)
+||
+'0000000000000440' -- ipY (float64 2.5)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'00000000' -- SRID (int32 0)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+)::raster
+,'BOX(0 0,5 5)' -- expected envelope
+);
+INSERT INTO rt_test_envelope
+VALUES ( 2, '1x1, ip:7.5,2.5 scale:5,5 skew:0,0',
+(
+'01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0000' -- nBands (uint16 0)
+||
+'0000000000001440' -- scaleX (float64 5)
+||
+'0000000000001440' -- scaleY (float64 5)
+||
+'0000000000001E40' -- ipX (float64 2.5)
+||
+'0000000000000440' -- ipY (float64 2.5)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'00000000' -- SRID (int32 0)
+||
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+)::raster
+,'BOX(5 0,10 5)' -- expected envelope
+);
+
SELECT
id,
env as expected,
More information about the postgis-commits
mailing list