Definition
The ST_PixelData.getValue function returns the value of a single pixel given that pixel's location within the ST_PixelData object. The location can be specified either in pixel coordinates or geographic coordinates. The function returns an error whenever the specified location is beyond the raster pixel dimension or geographic extent. ST_PixelData.getValue returns NULL if the pixel value at the specified location is NoData.
Syntax
Oracle
getValue (band INTEGER, level INTEGER, x INTEGER, y INTEGER) getValue (band INTEGER, level INTEGER, point SE_COORD)
PostgreSQL
getValue (data IN ST_PIXELDATA, band IN INT, x IN INT, y IN INT) getValue (data IN ST_PIXELDATA, band IN INT, point IN SE_COORD)
SQL Server
getValue (band IN INT, x IN INT, y IN INT) getValueByLoc (band IN INT, x IN double, y IN double)
Returns
Oracle
Number
PostgreSQL
Integer
SQL Server
Double
Parameters
Parameter | Description |
---|---|
band | The band number (beginning at 1) of the pixel |
level | The pyramid level of the pixel |
x | The x-pixel coordinate |
y | The y-pixel coordinate |
point | The geographic coordinate of the pixel |
Examples
The following returns the value of a single pixel given the location of that pixel within the ST_PixelData object.
Oracle
DECLARE
p sde.ST_PixelData;
pixelvalue NUMBER;
BEGIN
SELECT image.getPixelData() INTO p FROM MOAB;
pixelvalue := p.getvalue(1,0,1,1);
pixelvalue := p.getvalue(1,0,SE_COORD(34.057, 117.171));
END;
/
PostgreSQL
CREATE OR REPLACE FUNCTION get_pixel_value()
RETURNS integer AS '
DECLARE
p ST_PIXELDATA;
pixelvalue NUMBER;
BEGIN
SELECT getPixelData(image) INTO p FROM moab;
pixelvalue := getvalue(p,1,1,1);
pixelvalue := getvalue(p,1,SE_COORD(34.057, 117.171));
END;'
LANGUAGE plpgsql;
SELECT get_pixel_data();
DROP FUNCTION IF EXISTS get_pixel_data();
SQL Server
DECLARE
@p ST_Pixeldata;
@pixelvalue double;
SET @p = (SELECT image.getPixelData()
FROM moab );
SET @pixelvalue = @p.getValue(1,1,1);
SET @pixelvalue = @p.getValueByLoc(1, 34.057, 117.171);