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)
;
一次設定 6 個地理參考參數。接受 'GDAL' 或 'ESRI' 格式的輸入。預設為 GDAL。如果未提供 6 個坐標,則返回 null。
格式表示之間的差異如下
GDAL
:
scalex skewy skewx scaley upperleftx upperlefty
ESRI
:
scalex skewy skewx scaley upperleftx + scalex*0.5 upperlefty + scaley*0.5
![]() |
|
如果光柵具有外部資料庫頻帶,更改地理參考可能會導致錯誤地存取頻帶的外部儲存資料。 |
增強功能:2.1.0 新增 ST_SetGeoReference(raster, double precision, ...) 變體
WITH foo AS ( SELECT ST_MakeEmptyRaster(5, 5, 0, 0, 1, -1, 0, 0, 0) AS rast ) SELECT 0 AS rid, (ST_Metadata(rast)).* FROM foo UNION ALL SELECT 1, (ST_Metadata(ST_SetGeoReference(rast, '10 0 0 -10 0.1 0.1', 'GDAL'))).* FROM foo UNION ALL SELECT 2, (ST_Metadata(ST_SetGeoReference(rast, '10 0 0 -10 5.1 -4.9', 'ESRI'))).* FROM foo UNION ALL SELECT 3, (ST_Metadata(ST_SetGeoReference(rast, 1, 1, 10, -10, 0.001, 0.001))).* FROM foo rid | upperleftx | upperlefty | width | height | scalex | scaley | skewx | skewy | srid | numbands -----+--------------------+--------------------+-------+--------+--------+--------+-------+-------+------+---------- 0 | 0 | 0 | 5 | 5 | 1 | -1 | 0 | 0 | 0 | 0 1 | 0.1 | 0.1 | 5 | 5 | 10 | -10 | 0 | 0 | 0 | 0 2 | 0.0999999999999996 | 0.0999999999999996 | 5 | 5 | 10 | -10 | 0 | 0 | 0 | 0 3 | 1 | 1 | 5 | 5 | 10 | -10 | 0.001 | 0.001 | 0 | 0