제목

ST_SetGeoReference — 단일 호출로 지리참조 파라미터 6개를 설정합니다. 숫자를 공백으로 구분해야 합니다. GDAL 또는 ESRI 서식의 입력물을 받아들입니다. 기본값은 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);

Description

단일 호출로 지리참조 파라미터 6개를 설정합니다. 'GDAL' 또는 'ESRI' 서식의 입력물을 받아들입니다. 기본값은 GDAL입니다. 6개의 좌표를 입력하지 않을 경우 NULL을 반환할 것입니다.

형식 표현식 사이의 차이점은 다음과 같습니다:

GDAL uses the value order shown below.

Code
scalex skewy skewx scaley upperleftx upperlefty

ESRI uses the value order shown below.

Code
scalex skewy skewx scaley upperleftx + scalex*0.5 upperlefty + scaley*0.5
[참고]

래스터가 DB 외부 밴드를 가지고 있을 경우, 지리참조 파라미터를 변경하면 밴드의 외부 저장 데이터에 접근하는 데 오류가 발생할 수도 있습니다.

개선 사항: 2.1.0버전에서 ST_SetGeoReference(raster, double precision, ...) 변종이 추가됐습니다.

예시

Code
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)