mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-24 09:02:37 +00:00
9369f89557
git-svn-id: http://svn.osgeo.org/postgis/trunk@9154 b70326c6-7e19-0410-871a-916f4a2858ee
247 lines
5.5 KiB
PL/PgSQL
247 lines
5.5 KiB
PL/PgSQL
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, TRUE, ARRAY[]::double precision[], 0);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, TRUE, NULL::double precision[], 0);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, FALSE, NULL::double precision[], 0);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, TRUE, NULL::double precision[], 0.1);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, ARRAY[3.1], 0.1);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, ARRAY[-10]);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, ARRAY[-10], 0);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, ARRAY[-10, 3]);
|
|
SELECT round(ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, TRUE, 3.14, 0.19)::numeric, 3);
|
|
SELECT round(ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, FALSE, 3.14, 0.01)::numeric, 3);
|
|
SELECT round(ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, -10, 0.1)::numeric, 3);
|
|
SELECT round(ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 1, -10)::numeric, 3);
|
|
SELECT round(ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, -10., 10)::numeric, 3);
|
|
SELECT round(ST_ValuePercent(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
)
|
|
, 3.14159)::numeric, 3);
|
|
BEGIN;
|
|
CREATE TEMP TABLE test
|
|
ON COMMIT DROP AS
|
|
SELECT
|
|
rast.rast
|
|
FROM (
|
|
SELECT ST_SetValue(
|
|
ST_SetValue(
|
|
ST_SetValue(
|
|
ST_AddBand(
|
|
ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0,0)
|
|
, 1, '64BF', 0, 0
|
|
)
|
|
, 1, 1, 1, -10
|
|
)
|
|
, 1, 5, 4, 0
|
|
)
|
|
, 1, 5, 5, 3.14159
|
|
) AS rast
|
|
) AS rast
|
|
FULL JOIN (
|
|
SELECT generate_series(1, 10) AS id
|
|
) AS id
|
|
ON 1 = 1;
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent('test', 'rast', 1, FALSE, NULL::double precision[], 0);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent('test', 'rast', 1, ARRAY[-10]::double precision[], 0);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent('test', 'rast', 1, ARRAY[1]::double precision[]);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent('test', 'rast', NULL::double precision[], 0.1);
|
|
SELECT round(value::numeric, 3), round(percent::numeric, 3) FROM ST_ValuePercent('test', 'rast', ARRAY[-1, 3.1]::double precision[], 0.1);
|
|
|
|
SELECT round(ST_ValuePercent('test', 'rast', 1, TRUE, NULL::double precision, 0)::numeric, 3);
|
|
SELECT round(ST_ValuePercent('test', 'rast', 1, 3.14, 1)::numeric, 3);
|
|
SELECT round(ST_ValuePercent('test', 'rast', 1, -1)::numeric, 3);
|
|
SELECT round(ST_ValuePercent('test', 'rast', 3.1, 0.1)::numeric, 3);
|
|
SELECT round(ST_ValuePercent('test', 'rast', -9.)::numeric, 3);
|
|
ROLLBACK;
|