Name

ST_SetBandIndex — Aktualisiert die externe Bandnummer eines out-db Bandes.

Übersicht

raster ST_SetBandIndex(raster rast, integer band, integer outdbindex, boolean force=false);

Description

Aktualisiert die externe Bandnummer eines out-db Bandes. Die mit dem out-db Band assoziierte externe Rasterdatei wird davon nicht betroffen

[Anmerkung]

Wenn force auf TRUE gesetzt ist, wird die Kompatibilität (z.B. Ausrichtung, Pixelunterstützung) zwischen der externen Rasterdatei und dem PostGIS Raster nicht überprüft. Dieser Modus ist für das Verschieben von Bändern in einer externen Rasterdatei vorgesehen.

[Anmerkung]

Intern wird bei dieser Methode das PostGIS Raster Band mit dem Index band durch ein neues Band ersetzt, ohne dass die existierende Pfadinformation aktualisiert wird.

Verfügbarkeit: 2.5.0

Beispiele

Code
WITH foo AS (
    SELECT ST_AddBand(
        NULL::raster,
        '/home/pele/devel/geo/postgis-git/raster/test/regress/loader/Projected.tif',
        NULL::int[]
    ) AS rast
)
SELECT
    1 AS query,
    bandnum,
    regexp_replace(path, '^.*/', '') AS path,
    outdbbandnum
FROM ST_BandMetaData(
    (SELECT rast FROM foo),
    ARRAY[1, 3, 2]::int[]
) AS metadata
UNION ALL
SELECT
    2, bandnum,
    regexp_replace(path, '^.*/', ''),
    outdbbandnum
FROM ST_BandMetaData((
        SELECT
            ST_SetBandIndex(rast,
                2,
                1
            ) AS rast
        FROM foo
    ),
    ARRAY[1, 3, 2]::int[]
) AS metadata
ORDER BY 1, 2;

In the second result set, band 2 still points at the same file but now reads external band 1.

Ausgabe von Rastern
query | bandnum | path          | outdbbandnum
-------+---------+---------------+--------------
     1 |       1 | Projected.tif |            1
     1 |       2 | Projected.tif |            2
     1 |       3 | Projected.tif |            3
     2 |       1 | Projected.tif |            1
     2 |       2 | Projected.tif |            1
     2 |       3 | Projected.tif |            3