名稱

ST_SetBandNoDataValue — 設定給定圖層中代表無資料的值。如果未指定圖層,則預設為圖層 1。若要將圖層標記為沒有無資料值,請將無資料值設定為 NULL。

概要

raster ST_SetBandNoDataValue(raster rast, double precision nodatavalue);

raster ST_SetBandNoDataValue(raster rast, integer band, double precision nodatavalue, boolean forcechecking=false);

描述

設定代表圖層無資料的值。如果未指定,則預設為圖層 1。這將影響 ST_PolygonST_DumpAsPolygons 和 ST_PixelAs...() 函數的結果。

範例

-- change just first band no data value
UPDATE dummy_rast
    SET rast = ST_SetBandNoDataValue(rast,1, 254)
WHERE rid = 2;

-- change no data band value of bands 1,2,3
UPDATE dummy_rast
    SET rast =
        ST_SetBandNoDataValue(
            ST_SetBandNoDataValue(
                ST_SetBandNoDataValue(
                    rast,1, 254)
                ,2,99),
                3,108)
        WHERE rid = 2;

-- wipe out the nodata value this will ensure all pixels are considered for all processing functions
UPDATE dummy_rast
    SET rast = ST_SetBandNoDataValue(rast,1, NULL)
WHERE rid = 2;