From: Bborie Park Date: Fri, 14 Dec 2012 20:26:30 +0000 (+0000) Subject: Tweaked the extent computed for the extent constraint X-Git-Tag: 2.1.0beta2~299 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00fd6a924cf111a3e6c1864888887e10471ae1e8;p=postgis Tweaked the extent computed for the extent constraint git-svn-id: http://svn.osgeo.org/postgis/trunk@10832 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index beb7ba181..9eda2ee89 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -6340,23 +6340,23 @@ CREATE OR REPLACE FUNCTION _add_raster_constraint_extent(rastschema name, rastta cn := 'enforce_max_extent_' || $3; - sql := 'SELECT st_ashexewkb(st_convexhull(st_collect(st_convexhull(' + sql := 'SELECT st_ashexewkb(st_union(st_convexhull(' || quote_ident($3) - || ')))) FROM ' + || '))) FROM ' || fqtn; BEGIN EXECUTE sql INTO attr; EXCEPTION WHEN OTHERS THEN - RAISE NOTICE 'Unable to get the extent of a sample raster. Attempting memory efficient (slower) approach'; + RAISE NOTICE 'Unable to get the extent of the raster column. Attempting memory efficient (slower) approach'; - sql := 'SELECT st_ashexewkb(st_convexhull(st_memunion(st_convexhull(' + sql := 'SELECT st_ashexewkb(st_memunion(st_convexhull(' || quote_ident($3) - || ')))) FROM ' + || '))) FROM ' || fqtn; BEGIN EXECUTE sql INTO attr; EXCEPTION WHEN OTHERS THEN - RAISE NOTICE 'Still unable to get the extent of a sample raster. Cannot add extent constraint'; + RAISE NOTICE 'Still unable to get the extent of the raster column. Cannot add extent constraint'; RETURN FALSE; END; END; diff --git a/raster/test/regress/check_raster_columns.sql b/raster/test/regress/check_raster_columns.sql index 789219610..68e79258d 100644 --- a/raster/test/regress/check_raster_columns.sql +++ b/raster/test/regress/check_raster_columns.sql @@ -64,22 +64,22 @@ SELECT make_test_raster(3, 2, 2, 1, 1, 0, 0, 4); SELECT make_test_raster(4, 2, 2, 2, 2, 0, 0, 5); SELECT AddRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name = 'test_raster_columns'; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name = 'test_raster_columns'; SELECT DropRasterConstraints(current_schema(),'test_raster_columns', 'rast'::name); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name = 'test_raster_columns'; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name = 'test_raster_columns'; SELECT AddRasterConstraints('test_raster_columns', 'rast'::name, 'srid'::text, 'extent', 'blocksize'); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name = 'test_raster_columns'; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name = 'test_raster_columns'; SELECT DropRasterConstraints('test_raster_columns', 'rast'::name, 'scale'::text); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name = 'test_raster_columns'; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name = 'test_raster_columns'; SELECT AddRasterConstraints('test_raster_columns', 'rast', FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name = 'test_raster_columns'; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name = 'test_raster_columns'; SELECT DropRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name, 'scale'::text); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name = 'test_raster_columns'; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name = 'test_raster_columns'; DROP FUNCTION make_test_raster(integer, integer, integer, double precision, double precision, double precision, double precision, double precision, double precision); DROP TABLE IF EXISTS test_raster_columns; diff --git a/raster/test/regress/check_raster_columns_expected b/raster/test/regress/check_raster_columns_expected index d28b23d02..067854ff4 100644 --- a/raster/test/regress/check_raster_columns_expected +++ b/raster/test/regress/check_raster_columns_expected @@ -1,13 +1,13 @@ raster_columns t -test_raster_columns|rast|0|1|1|2|2|t|f|1|{8BUI}|{0}|0103000000010000000800000000000000000000C000000000000000C000000000000000C000000000000000000000000000000040000000000000104000000000000010400000000000001040000000000000104000000000000000400000000000000840000000000000F0BF000000000000000000000000000000C000000000000000C000000000000000C0 +test_raster_columns|rast|0|1|1|2|2|t|f|1|{8BUI}|{0}|MULTIPOLYGON(((0 0,0 -2,-2 -2,-2 0,0 0)),((3 1,3 -1,1 -1,1 0,0 0,0 2,1 2,1 3,2 3,2 4,4 4,4 2,3 2,3 1))) t test_raster_columns|rast|0|||||f|f|||| t -test_raster_columns|rast|0|||2|2|f|f||||0103000000010000000800000000000000000000C000000000000000C000000000000000C000000000000000000000000000000040000000000000104000000000000010400000000000001040000000000000104000000000000000400000000000000840000000000000F0BF000000000000000000000000000000C000000000000000C000000000000000C0 +test_raster_columns|rast|0|||2|2|f|f||||MULTIPOLYGON(((0 0,0 -2,-2 -2,-2 0,0 0)),((3 1,3 -1,1 -1,1 0,0 0,0 2,1 2,1 3,2 3,2 4,4 4,4 2,3 2,3 1))) t -test_raster_columns|rast|0|||2|2|f|f||||0103000000010000000800000000000000000000C000000000000000C000000000000000C000000000000000000000000000000040000000000000104000000000000010400000000000001040000000000000104000000000000000400000000000000840000000000000F0BF000000000000000000000000000000C000000000000000C000000000000000C0 +test_raster_columns|rast|0|||2|2|f|f||||MULTIPOLYGON(((0 0,0 -2,-2 -2,-2 0,0 0)),((3 1,3 -1,1 -1,1 0,0 0,0 2,1 2,1 3,2 3,2 4,4 4,4 2,3 2,3 1))) t -test_raster_columns|rast|0|1|1|2|2|t|f|1||{0}|0103000000010000000800000000000000000000C000000000000000C000000000000000C000000000000000000000000000000040000000000000104000000000000010400000000000001040000000000000104000000000000000400000000000000840000000000000F0BF000000000000000000000000000000C000000000000000C000000000000000C0 +test_raster_columns|rast|0|1|1|2|2|t|f|1||{0}|MULTIPOLYGON(((0 0,0 -2,-2 -2,-2 0,0 0)),((3 1,3 -1,1 -1,1 0,0 0,0 2,1 2,1 3,2 3,2 4,4 4,4 2,3 2,3 1))) t -test_raster_columns|rast|0|||2|2|t|f|1||{0}|0103000000010000000800000000000000000000C000000000000000C000000000000000C000000000000000000000000000000040000000000000104000000000000010400000000000001040000000000000104000000000000000400000000000000840000000000000F0BF000000000000000000000000000000C000000000000000C000000000000000C0 +test_raster_columns|rast|0|||2|2|t|f|1||{0}|MULTIPOLYGON(((0 0,0 -2,-2 -2,-2 0,0 0)),((3 1,3 -1,1 -1,1 0,0 0,0 2,1 2,1 3,2 3,2 4,4 4,4 2,3 2,3 1))) diff --git a/raster/test/regress/check_raster_overviews.sql b/raster/test/regress/check_raster_overviews.sql index 8f3e86ffd..e32b24dc7 100644 --- a/raster/test/regress/check_raster_overviews.sql +++ b/raster/test/regress/check_raster_overviews.sql @@ -67,23 +67,23 @@ SELECT make_test_raster(4, 2, 2, 2, 2, 0, 0, 5); SELECT * INTO test_raster_overviews FROM test_raster_columns; -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; SELECT o_table_name, o_raster_column, r_table_name, r_raster_column, overview_factor FROM raster_overviews WHERE o_table_name = 'test_raster_overviews'; SELECT AddRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; SELECT o_table_name, o_raster_column, r_table_name, r_raster_column, overview_factor FROM raster_overviews WHERE o_table_name = 'test_raster_overviews'; SELECT AddOverviewConstraints('test_raster_overviews', 'rast', 'test_raster_columns', 'rast', 1); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; SELECT o_table_name, o_raster_column, r_table_name, r_raster_column, overview_factor FROM raster_overviews WHERE o_table_name = 'test_raster_overviews'; SELECT DropOverviewConstraints(current_schema(), 'test_raster_overviews', 'rast'); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; SELECT o_table_name, o_raster_column, r_table_name, r_raster_column, overview_factor FROM raster_overviews WHERE o_table_name = 'test_raster_overviews'; SELECT DropRasterConstraints(current_schema(), 'test_raster_columns', 'rast'::name); -SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, extent FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; +SELECT r_table_name, r_raster_column, srid, scale_x, scale_y, blocksize_x, blocksize_y, same_alignment, regular_blocking, num_bands, pixel_types, nodata_values, ST_AsEWKT(extent) FROM raster_columns WHERE r_table_name IN ('test_raster_columns', 'test_raster_overviews') ORDER BY r_table_name, r_raster_column; SELECT o_table_name, o_raster_column, r_table_name, r_raster_column, overview_factor FROM raster_overviews WHERE o_table_name = 'test_raster_overviews'; DROP FUNCTION make_test_raster(integer, integer, integer, double precision, double precision, double precision, double precision, double precision, double precision); diff --git a/raster/test/regress/check_raster_overviews_expected b/raster/test/regress/check_raster_overviews_expected index 119882686..15f0036f6 100644 --- a/raster/test/regress/check_raster_overviews_expected +++ b/raster/test/regress/check_raster_overviews_expected @@ -2,14 +2,14 @@ raster_overviews test_raster_columns|rast|0|||||f|f|||| test_raster_overviews|rast|0|||||f|f|||| t -test_raster_columns|rast|0|1|1|2|2|t|f|1|{8BUI}|{0}|0103000000010000000800000000000000000000C000000000000000C000000000000000C000000000000000000000000000000040000000000000104000000000000010400000000000001040000000000000104000000000000000400000000000000840000000000000F0BF000000000000000000000000000000C000000000000000C000000000000000C0 +test_raster_columns|rast|0|1|1|2|2|t|f|1|{8BUI}|{0}|MULTIPOLYGON(((0 0,0 -2,-2 -2,-2 0,0 0)),((3 1,3 -1,1 -1,1 0,0 0,0 2,1 2,1 3,2 3,2 4,4 4,4 2,3 2,3 1))) test_raster_overviews|rast|0|||||f|f|||| t -test_raster_columns|rast|0|1|1|2|2|t|f|1|{8BUI}|{0}|0103000000010000000800000000000000000000C000000000000000C000000000000000C000000000000000000000000000000040000000000000104000000000000010400000000000001040000000000000104000000000000000400000000000000840000000000000F0BF000000000000000000000000000000C000000000000000C000000000000000C0 +test_raster_columns|rast|0|1|1|2|2|t|f|1|{8BUI}|{0}|MULTIPOLYGON(((0 0,0 -2,-2 -2,-2 0,0 0)),((3 1,3 -1,1 -1,1 0,0 0,0 2,1 2,1 3,2 3,2 4,4 4,4 2,3 2,3 1))) test_raster_overviews|rast|0|||||f|f|||| test_raster_overviews|rast|test_raster_columns|rast|1 t -test_raster_columns|rast|0|1|1|2|2|t|f|1|{8BUI}|{0}|0103000000010000000800000000000000000000C000000000000000C000000000000000C000000000000000000000000000000040000000000000104000000000000010400000000000001040000000000000104000000000000000400000000000000840000000000000F0BF000000000000000000000000000000C000000000000000C000000000000000C0 +test_raster_columns|rast|0|1|1|2|2|t|f|1|{8BUI}|{0}|MULTIPOLYGON(((0 0,0 -2,-2 -2,-2 0,0 0)),((3 1,3 -1,1 -1,1 0,0 0,0 2,1 2,1 3,2 3,2 4,4 4,4 2,3 2,3 1))) test_raster_overviews|rast|0|||||f|f|||| t test_raster_columns|rast|0|||||f|f|||| diff --git a/raster/test/regress/loader/Basic.select.expected b/raster/test/regress/loader/Basic.select.expected index 856d81fb0..9b79c8226 100644 --- a/raster/test/regress/loader/Basic.select.expected +++ b/raster/test/regress/loader/Basic.select.expected @@ -1,4 +1,4 @@ -0|1.0000000000|-1.0000000000|90|90|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((0 -90,0 0,90 0,90 -90,0 -90)) +0|1.0000000000|-1.0000000000|90|90|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((0 0,90 0,90 -90,0 -90,0 0)) POLYGON((0 0,1 0,1 -1,0 -1,0 0))|255 POLYGON((89 -89,90 -89,90 -90,89 -90,89 -89))|0 POLYGON((44 -44,45 -44,45 -45,44 -45,44 -44))|0 diff --git a/raster/test/regress/loader/BasicCopy.select.expected b/raster/test/regress/loader/BasicCopy.select.expected index 856d81fb0..9b79c8226 100644 --- a/raster/test/regress/loader/BasicCopy.select.expected +++ b/raster/test/regress/loader/BasicCopy.select.expected @@ -1,4 +1,4 @@ -0|1.0000000000|-1.0000000000|90|90|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((0 -90,0 0,90 0,90 -90,0 -90)) +0|1.0000000000|-1.0000000000|90|90|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((0 0,90 0,90 -90,0 -90,0 0)) POLYGON((0 0,1 0,1 -1,0 -1,0 0))|255 POLYGON((89 -89,90 -89,90 -90,89 -90,89 -89))|0 POLYGON((44 -44,45 -44,45 -45,44 -45,44 -44))|0 diff --git a/raster/test/regress/loader/Tiled10x10.select.expected b/raster/test/regress/loader/Tiled10x10.select.expected index 5f882d250..ef06f3def 100644 --- a/raster/test/regress/loader/Tiled10x10.select.expected +++ b/raster/test/regress/loader/Tiled10x10.select.expected @@ -1,4 +1,4 @@ -0|1.0000000000|-1.0000000000|10|10|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((0 -90,0 0,90 0,90 -90,0 -90)) +0|1.0000000000|-1.0000000000|10|10|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((90 -80,90 -90,80 -90,70 -90,60 -90,50 -90,40 -90,30 -90,20 -90,10 -90,0 -90,0 -80,0 -70,0 -60,0 -50,0 -40,0 -30,0 -20,0 -10,0 0,10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,90 -10,90 -20,90 -30,90 -40,90 -50,90 -60,90 -70,90 -80)) POLYGON((0 0,1 0,1 -1,0 -1,0 0))|255 POLYGON((0 -80,1 -80,1 -81,0 -81,0 -80))|255 POLYGON((80 -80,81 -80,81 -81,80 -81,80 -80))|255 diff --git a/raster/test/regress/loader/Tiled10x10Copy.select.expected b/raster/test/regress/loader/Tiled10x10Copy.select.expected index 5f882d250..ef06f3def 100644 --- a/raster/test/regress/loader/Tiled10x10Copy.select.expected +++ b/raster/test/regress/loader/Tiled10x10Copy.select.expected @@ -1,4 +1,4 @@ -0|1.0000000000|-1.0000000000|10|10|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((0 -90,0 0,90 0,90 -90,0 -90)) +0|1.0000000000|-1.0000000000|10|10|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((90 -80,90 -90,80 -90,70 -90,60 -90,50 -90,40 -90,30 -90,20 -90,10 -90,0 -90,0 -80,0 -70,0 -60,0 -50,0 -40,0 -30,0 -20,0 -10,0 0,10 0,20 0,30 0,40 0,50 0,60 0,70 0,80 0,90 0,90 -10,90 -20,90 -30,90 -40,90 -50,90 -60,90 -70,90 -80)) POLYGON((0 0,1 0,1 -1,0 -1,0 0))|255 POLYGON((0 -80,1 -80,1 -81,0 -81,0 -80))|255 POLYGON((80 -80,81 -80,81 -81,80 -81,80 -80))|255 diff --git a/raster/test/regress/loader/Tiled8x8.select.expected b/raster/test/regress/loader/Tiled8x8.select.expected index 2483c6b6c..1ce118fc0 100644 --- a/raster/test/regress/loader/Tiled8x8.select.expected +++ b/raster/test/regress/loader/Tiled8x8.select.expected @@ -1,4 +1,4 @@ -0|1.0000000000|-1.0000000000|8|8|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((0 -90,0 0,90 0,90 -90,0 -90)) +0|1.0000000000|-1.0000000000|8|8|t|f|3|{8BUI,8BUI,8BUI}|{NULL,NULL,NULL}|{f,f,f}|POLYGON((16 -90,8 -90,0 -90,0 -88,0 -80,0 -72,0 -64,0 -56,0 -48,0 -40,0 -32,0 -24,0 -16,0 -8,0 0,8 0,16 0,24 0,32 0,40 0,48 0,56 0,64 0,72 0,80 0,88 0,90 0,90 -8,90 -16,90 -24,90 -32,90 -40,90 -48,90 -56,90 -64,90 -72,90 -80,90 -88,90 -90,88 -90,80 -90,72 -90,64 -90,56 -90,48 -90,40 -90,32 -90,24 -90,16 -90)) POLYGON((88 0,89 0,89 -1,88 -1,88 0))|255 POLYGON((88 0,89 0,89 -1,88 -1,88 0))|255 POLYGON((0 -88,1 -88,1 -89,0 -89,0 -88))|255