ST_Slope — 返回高程栅格标注栏的坡度(默认情况下以度为单位)。对于分析地形非常有用。
raster
ST_Slope
(
raster
rast
, integer
nband=1
, text
pixeltype=32BF
, text
units=DEGREES
, double precision
scale=1.0
, boolean
interpolate_nodata=FALSE
)
;
raster
ST_Slope
(
raster
rast
, integer
nband
, raster
customextent
, text
pixeltype=32BF
, text
units=DEGREES
, double precision
scale=1.0
, boolean
interpolate_nodata=FALSE
)
;
返回高程栅格标注栏的坡度(默认情况下以度为单位)。利用地图代数并将斜率方程应用于相邻像素。
units
指示坡度的单位。可能的值有:弧度、度(默认)、百分比。
scale
是垂直单位与水平单位的比率。对于英尺:拉特隆使用比例=370400,对于米:拉特龙使用比例=111120。
如果
interpolate_nodata
为真,则输入栅格中的NODATA像素值将使用
ST_InvDistWeight4ma
在计算表面坡度之前。
![]() |
|
有关坡度、坡向和山体阴影的更多信息,请参阅 ESRI-山体阴影的工作原理 和 ERDAS野外指南-坡度图像 。 |
可用性:2.0.0
增强版:2.1.0使用ST_MapAlgebra()并添加了可选
units
,
scale
,
interpolate_nodata
函数参数
更改:2.1.0在以前的版本中,返回值以弧度为单位。现在,返回值默认为度
WITH foo AS (
SELECT ST_SetValues(
ST_AddBand(ST_MakeEmptyRaster(5, 5, 0, 0, 1, -1, 0, 0, 0), 1, '32BF', 0, -9999),
1, 1, 1, ARRAY[
[1, 1, 1, 1, 1],
[1, 2, 2, 2, 1],
[1, 2, 3, 2, 1],
[1, 2, 2, 2, 1],
[1, 1, 1, 1, 1]
]::double precision[][]
) AS rast
)
SELECT
ST_DumpValues(ST_Slope(rast, 1, '32BF'))
FROM foo
st_dumpvalues
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------
(1,"{{10.0249881744385,21.5681285858154,26.5650520324707,21.5681285858154,10.0249881744385},{21.5681285858154,35.2643890380859,36.8698959350586,35.2643890380859,21.5681285858154},
{26.5650520324707,36.8698959350586,0,36.8698959350586,26.5650520324707},{21.5681285858154,35.2643890380859,36.8698959350586,35.2643890380859,21.5681285858154},{10.0249881744385,21.
5681285858154,26.5650520324707,21.5681285858154,10.0249881744385}}")
(1 row)
Coverage平铺的完整示例。此查询仅适用于PostgreSQL 9.1或更高版本。
WITH foo AS (
SELECT ST_Tile(
ST_SetValues(
ST_AddBand(
ST_MakeEmptyRaster(6, 6, 0, 0, 1, -1, 0, 0, 0),
1, '32BF', 0, -9999
),
1, 1, 1, ARRAY[
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 2, 1],
[1, 2, 2, 3, 3, 1],
[1, 1, 3, 2, 1, 1],
[1, 2, 2, 1, 2, 1],
[1, 1, 1, 1, 1, 1]
]::double precision[]
),
2, 2
) AS rast
)
SELECT
t1.rast,
ST_Slope(ST_Union(t2.rast), 1, t1.rast)
FROM foo t1
CROSS JOIN foo t2
WHERE ST_Intersects(t1.rast, t2.rast)
GROUP BY t1.rast;