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

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Wed Nov 7 13:58:51 PST 2012


ST_PixelSizeX(raster) was replaced by ST_ScaleX(raster) since a while.

There is a function to convert a raster to polygons: ST_DumpAsPolygons()...

Pierre

> -----Original Message-----
> From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-
> bounces at lists.osgeo.org] On Behalf Of Mahavir Trivedi
> Sent: Wednesday, November 07, 2012 6:42 AM
> To: PostGIS Users Discussion
> Subject: [postgis-users] ST_PixelSixeX(raster) does not exist : error
> 
> 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;


More information about the postgis-users mailing list