ST_SetGeoReference — Coloque os parâmetros Georeference 6 em uma única chamada. Os números deverão ser separadospor espaço branco. Aceita entrar no formato GDAL ou ESRI. O padrão é GDAL.
raster ST_SetGeoReference(raster rast, text georefcoords, text format=GDAL);
raster ST_SetGeoReference(raster rast, double precision upperleftx, double precision upperlefty, double precision scalex, double precision scaley, double precision skewx, double precision skewy);
Coloca os parâmetros georreferência 6 em uma única chamada. Aceita entrar no formato GDAL ou ESRI. O padrão é GDAL. Se 6 coordenadas não forem fornecidas, retornará null.
A diferença entre representações de formatos é a seguinte:
GDAL uses the value order shown below.
scalex skewy skewx scaley upperleftx upperlefty
ESRI uses the value order shown below.
scalex skewy skewx scaley upperleftx + scalex*0.5 upperlefty + scaley*0.5
|
|
|
Se o raster tiver bandas fora do banco de dados, alterar a georreferência pode resultar em acesso incorreto dos dados de banda armazenados externamente. |
Melhorias: 2.1.0 Adição da variante ST_SetGeoReference(raster, double precision, ...)
WITH source AS (
SELECT ST_MakeEmptyRaster(5, 5, 0, 0, 1, -1, 0, 0, 0) AS rast
), variants AS (
SELECT 0 AS rid, rast FROM source
UNION ALL
SELECT 1, ST_SetGeoReference(rast, '10 0 0 -10 0.1 0.1', 'GDAL')
FROM source
UNION ALL
SELECT 2, ST_SetGeoReference(rast, '10 0 0 -10 5.1 -4.9', 'ESRI')
FROM source
UNION ALL
SELECT 3, ST_SetGeoReference(rast, 1, 1, 10, -10, 0.001, 0.001)
FROM source
)
SELECT
rid,
round(ST_UpperLeftX(rast)::numeric, 3) AS upperleftx,
round(ST_UpperLeftY(rast)::numeric, 3) AS upperlefty,
ST_ScaleX(rast) AS scalex,
ST_ScaleY(rast) AS scaley,
ST_SkewX(rast) AS skewx,
ST_SkewY(rast) AS skewy
FROM variants
ORDER BY rid;
rid | upperleftx | upperlefty | scalex | scaley | skewx | skewy -----+------------+------------+--------+--------+-------+------- 0 | 0.000 | 0.000 | 1 | -1 | 0 | 0 1 | 0.100 | 0.100 | 10 | -10 | 0 | 0 2 | 0.100 | 0.100 | 10 | -10 | 0 | 0 3 | 1.000 | 1.000 | 10 | -10 | 0.001 | 0.001 (4 rows)
ST_GeoReference, ST_ScaleX, ST_ScaleY, ST_UpperLeftX, ST_UpperLeftY