From: Bborie Park Date: Thu, 2 Aug 2012 19:27:55 +0000 (+0000) Subject: Tweaked tests to use new variants of ST_AddBand and ST_SetValues X-Git-Tag: 2.1.0beta2~718 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9bb86a38b839162e3553ed0cffb86e5e54c436f8;p=postgis Tweaked tests to use new variants of ST_AddBand and ST_SetValues git-svn-id: http://svn.osgeo.org/postgis/trunk@10154 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/test/regress/rt_band.sql b/raster/test/regress/rt_band.sql index f01bcca43..748a907ef 100644 --- a/raster/test/regress/rt_band.sql +++ b/raster/test/regress/rt_band.sql @@ -4,14 +4,12 @@ SELECT ST_Value(ST_Band(ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, SELECT ST_Value( ST_Band( ST_AddBand( - ST_AddBand( - ST_AddBand( - ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0) - , 1, '64BF', 1234.5678, NULL - ) - , '64BF', 987.654321, NULL - ) - , '64BF', 9876.54321, NULL + ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0), + ARRAY[ + ROW(1, '64BF', 1234.5678, NULL), + ROW(NULL, '64BF', 987.654321, NULL), + ROW(NULL, '64BF', 9876.54321, NULL) + ]::addbandarg[] ), ARRAY[1] ), @@ -19,14 +17,12 @@ SELECT ST_Value( SELECT ST_Value( ST_Band( ST_AddBand( - ST_AddBand( - ST_AddBand( - ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0) - , 1, '64BF', 1234.5678, NULL - ) - , '64BF', 987.654321, NULL - ) - , '64BF', 9876.54321, NULL + ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0), + ARRAY[ + ROW(1, '64BF', 1234.5678, NULL), + ROW(NULL, '64BF', 987.654321, NULL), + ROW(NULL, '64BF', 9876.54321, NULL) + ]::addbandarg[] ), ARRAY[2] ), @@ -34,14 +30,12 @@ SELECT ST_Value( SELECT ST_Value( ST_Band( ST_AddBand( - ST_AddBand( - ST_AddBand( - ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0) - , 1, '64BF', 1234.5678, NULL - ) - , '64BF', 987.654321, NULL - ) - , '64BF', 9876.54321, NULL + ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0), + ARRAY[ + ROW(1, '64BF', 1234.5678, NULL), + ROW(NULL, '64BF', 987.654321, NULL), + ROW(NULL, '64BF', 9876.54321, NULL) + ]::addbandarg[] ), ARRAY[3] ), @@ -49,14 +43,12 @@ SELECT ST_Value( SELECT ST_Value( ST_Band( ST_AddBand( - ST_AddBand( - ST_AddBand( - ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0) - , 1, '64BF', 1234.5678, NULL - ) - , '64BF', 987.654321, NULL - ) - , '64BF', 9876.54321, NULL + ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0), + ARRAY[ + ROW(1, '64BF', 1234.5678, NULL), + ROW(NULL, '64BF', 987.654321, NULL), + ROW(NULL, '64BF', 9876.54321, NULL) + ]::addbandarg[] ), 1 ), @@ -79,14 +71,12 @@ SELECT ST_Value( SELECT ST_Value( ST_Band( ST_AddBand( - ST_AddBand( - ST_AddBand( - ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0) - , 1, '64BF', 1234.5678, NULL - ) - , '64BF', 987.654321, NULL - ) - , '64BF', 9876.54321, NULL + ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0,0), + ARRAY[ + ROW(1, '64BF', 1234.5678, NULL), + ROW(NULL, '64BF', 987.654321, NULL), + ROW(NULL, '64BF', 9876.54321, NULL) + ]::addbandarg[] ), 3 ), diff --git a/raster/test/regress/rt_nearestvalue.sql b/raster/test/regress/rt_nearestvalue.sql index e4d0b2112..bdb4cac8a 100644 --- a/raster/test/regress/rt_nearestvalue.sql +++ b/raster/test/regress/rt_nearestvalue.sql @@ -11,15 +11,19 @@ CREATE OR REPLACE FUNCTION make_test_raster() x int; y int; rast raster; + valset double precision[][]; BEGIN rast := ST_MakeEmptyRaster(width, height, 0, 0, 1, -1, 0, 0, 0); rast := ST_AddBand(rast, 1, '8BUI', 1, 0); + + valset := array_fill(0., ARRAY[height, width]); FOR y IN 1..height LOOP FOR x IN 1..width LOOP - rast := ST_SetValue(rast, x, y, 2 * x + (1/3) * y); + valset[y][x] := 2 * x + (1/3) * y; END LOOP; END LOOP; + rast := ST_SetValues(rast, 1, 1, 1, valset); rast := ST_SetValue(rast, 1, 1, 0); rast := ST_SetValue(rast, 4, 1, 0);