[postgis-users] ST_PixelSixeX(raster) does not exist : error

Mahavir Trivedi mahavir.trivedi at gmail.com
Wed Nov 7 03:41:59 PST 2012


respected sir

when i execute belowing function we get following error

function ST_PixelSizeX(raster) does not exist


CREATE OR REPLACE FUNCTION public.upgis_rastertopolygon(param_rast
raster, param_bands integer[], param_sampling integer, param_valrange
float[][2])
  RETURNS geometry AS
$BODY$
DECLARE
 var_rows integer := ST_Height(param_rast);
 var_cols integer := ST_Width(param_rast);
 var_pixsizex float := ST_PixelSizeX(param_rast);
 var_pixsizey float := ST_PixelSizeY(param_rast);
 var_pixpoly geometry :=
ST_MakeEnvelope(ST_UpperLeftX(param_rast),ST_UpperLeftY(param_rast),
		ST_UpperLeftX(param_rast) + var_pixsizex*param_sampling,
ST_UpperLeftY(param_rast) + var_pixsizey*param_sampling,
ST_SRID(param_rast));
 var_result geometry;

BEGIN
	SELECT ST_Union(ST_Translate(var_pixpoly, x*var_pixsizex, y*var_pixsizey))
		INTO var_result
			FROM generate_series(1,var_cols,param_sampling) As x
					CROSS JOIN generate_series(1,var_rows,param_sampling) As y
		WHERE EXISTS (SELECT 1 FROM generate_series(1,
array_upper(param_bands,1)) As i
				WHERE ST_Value(param_rast, param_bands[i],x,y)
					BETWEEN param_valrange[i][1] AND param_valrange[i][2] ) ;
	RETURN var_result;
END
$BODY$
  LANGUAGE 'plpgsql' IMMUTABLE;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121107/7cec6809/attachment.html>


More information about the postgis-users mailing list