Hi all,
I am wondering if there is a better way do accomplish the following. To
create an array of values between two points from a raster. This is what
I have come up with.
{{{
CREATE or REPLACE Function sampledArray(rast raster, bandnum integer,
p1 geometry,p2 geometry, sampledistance double precision) RETURNS double
precision[] AS
$$
DECLARE
line geometry;
distance double precision;
samples integer;
sample double precision;
valuesarray double precision[];
BEGIN
line := ST_MakeLine($3,$4);
distance := ST_Distance($3,$4);
samples := floor(distance/sampledistance);
sample := sampledistance/distance;
for i in 0..samples by 1
LOOP
valuesarray[i] :=
ST_Value($1,$2,ST_Line_Interpolate_Point(line,sample*i));
END LOOP;
return valuesarray;
END;
$$
LANGUAGE plpgsql;
}}}
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users