名称

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
[Note]

如果栅格具有 out-db 波段,更改地理参考可能会导致对波段的外部存储数据的访问不正确。

增强: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
                

另请参阅

ST_GeoReferenceST_ScaleXST_ScaleYST_UpperLeftXST_UpperLeftY