raster_columns and raster_overviews
- #2532, Add missing raster/geometry commutator operators
- #2540, Change GUC name for GDAL_DATA to postgis.gdal_datapath
+ - #2552, Fix handling of NULL raster in ST_AsTIFF, ST_AsPNG
+ and ST_AsJPEG
* Code refactoring *
nodata double precision;
last_nodata double precision;
BEGIN
+ IF rast IS NULL THEN
+ RETURN NULL;
+ END IF;
+
num_bands := st_numbands($1);
-- TIFF only allows one NODATA value for ALL bands
num_bands int;
options text[];
BEGIN
+ IF rast IS NULL THEN
+ RETURN NULL;
+ END IF;
+
compression2 := trim(both from upper(compression));
IF length(compression2) > 0 THEN
num_bands int;
i int;
BEGIN
+ IF rast IS NULL THEN
+ RETURN NULL;
+ END IF;
+
num_bands := st_numbands($1);
-- JPEG allows 1 or 3 bands
i int;
pt text;
BEGIN
+ IF rast IS NULL THEN
+ RETURN NULL;
+ END IF;
+
num_bands := st_numbands($1);
-- PNG allows 1, 3 or 4 bands
+SELECT ST_AsJPEG(NULL) IS NULL;
SELECT CASE
WHEN length(
ST_AsJPEG(
+t
ERROR: The pixel type of band 1 in the raster is not 8BUI. The JPEG format can only be used with the 8BUI pixel type.
1
ERROR: The pixel type of band 1 in the raster is not 8BUI. The JPEG format can only be used with the 8BUI pixel type.
+SELECT ST_AsPNG(NULL) IS NULL;
SELECT CASE
WHEN length(
ST_AsPNG(
+t
ERROR: The pixel type of band 1 in the raster is not 8BUI or 16BUI. The PNG format can only be used with 8BUI and 16BUI pixel types.
1
ERROR: The pixel type of band 1 in the raster is not 8BUI or 16BUI. The PNG format can only be used with 8BUI and 16BUI pixel types.
+SELECT ST_AsTIFF(NULL) IS NULL;
+SELECT ST_AsTIFF(NULL, 'JPEG') IS NULL;
SELECT CASE
WHEN length(
ST_AsTIFF(