ST_AddZ
更新时间:
复制 MD 格式
Sets the Z coordinate of each point in a geometry based on the specified band of a raster.
Syntax
geometry ST_AddZ(raster source,
geometry geom,
integer pyramid,
integer band);Parameters
| Parameter | Description |
|---|---|
| source | The raster from which the geometry is converted. |
| geom | The geometry whose Z coordinate you want to specify. |
| pyramid | The pyramid level of the raster. Valid values: 0 to N-1, where N is the number of pyramid levels. Default value: 0. |
| band | The band of the raster. Valid values: 0 to N-1, where N is the number of bands. Default value: 0. |
Description
ST_AddZ sets the Z coordinate of each point in a geometry based on the specified band of the raster.
If the raster is georeferenced, the function returns geographic coordinates.
If the raster is not georeferenced, the function returns pixel coordinates.
All points in the geometry must fall within the raster.
Example
DO $$
declare
rast raster;
begin
select raster_obj into rast from raster_table where id = 1;
SELECT ST_AddZ(rast, ST_GeomFromText('POINT(120.5 30.6)', 4326), 0, 0);
end;
$$ LANGUAGE 'plpgsql';该文章对您有帮助吗?