Sets the Z coordinate of a geometry to the value of the specified raster band.
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 is set. |
| 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
Sets the Z coordinate of each point in the geometry to the value of the specified band at that point's location. If the raster is georeferenced, the function returns a geographic coordinate. If the raster is not georeferenced, the function returns a pixel coordinate.
Note
All points in the geometry must fall within the raster.
Examples
SELECT ST_AddZ(rast_object, ST_GeomFromText('POINT(120.5 30.6)', 4326), 0, 0)
FROM raster_table;
------------------------
POINT Z(120.5 30.6 27)
SELECT ST_AddZ(rast_object, ST_GeomFromText('POINT(120.5 30.6)', 4326), 1, 1)
FROM raster_table;
------------------------
POINT Z(120.5 30.6 115)该文章对您有帮助吗?