Pierre.Racine at sbf.ulaval.ca
Tue Oct 25 10:17:59 PDT 2011
> I tried to extract the elavation value of a particular location on the SRTM data i
> loaded on my database using the following command SELECT
> ST_Value(rast,ST_Point(-106.2,38.6)) AS Elevation From srtm;
> but it only brought out a long elevation column with no value shown.
> What could be the issue?
You have to assign a SRID to your point with ST_SetSRID(). If this SRID is not the same as the raster you must then reproject your point using ST_Transform().
> Also If i try to issue a command like this :
> SELECT ST_Value(rast) AS Elevation
> From srtm
> Where rid = 1304;
> Error message. "function st_value(raster) does not exist"
ST_Value is for extracting one value from a raster. What you wrote makes no sense since you are not saying which one to extract... You must specify the x and y of the pixel for which you want a value or pass a geometry point (in the same SRID).
More information about the postgis-users