[postgis-devel] ST_GetValues()

Paul Ramsey pramsey at cleverelephant.ca
Tue Apr 13 08:23:40 PDT 2021


More raster stuff, to go along with the surface interpolation and the contouring:

https://github.com/pramsey/postgis/tree/master-gdal-drape

An addition to ST_Value(), for the point-consuming variants, the implementation is now native not plpgsql, and there is a new optional argument at the end, "resample" which take either "nearest" or "bilinear". 

CREATE FUNCTION st_value(rast raster, band integer, pt geometry, exclude_nodata_value boolean DEFAULT TRUE, resample text DEFAULT 'nearest')
	RETURNS float8
	AS 'MODULE_PATHNAME', 'RASTER_getPixelValueResample'
	LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE;

And building on that, ST_GetValues() which reads values from a raster into the Z or M coordinates of a reference geometry.

CREATE FUNCTION st_getvalues(rast raster, geom geometry, resample text DEFAULT 'nearest', band integer default 1, dimension text default 'z')
	RETURNS geometry
	AS 'MODULE_PATHNAME', 'RASTER_getGeometryValues'
	LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE;

Comments appreciated.

P



More information about the postgis-devel mailing list