4

I have a table in postgresql that contains ID, row number, column number, pixel value and centroid of the pixel in WGS84 lat-lon system(4326). How could I extract the pixel value by giving a point in 4326 reference system?

asked Oct 30, 2012 at 13:53

1 Answer 1

3
SELECT pixel_value FROM raster_table
WHERE ST_Intersects(ST_SetSRID(ST_Point(xcoord,ycoord), 4326),rast)=TRUE;

Then according to your new comments the SQL-command could be

SELECT pixel_value FROM your_table_with_pixels
WHERE ST_Intersects(ST_SetSRID(ST_Point(xcoord,ycoord), 4326),ST_Buffer(geom, resolution_of_raster_cell))=TRUE;
answered Oct 30, 2012 at 14:22
6
  • Thank you Vladimir, but maybe my question was not clear enough. I'm not working on postgis raster. This is just a set of pixels of a raster file with row number, column number, pixel values and pixel centroid in 4326. Commented Oct 30, 2012 at 14:28
  • 1
    The pixels have to have coordinates, otherwise it is impossible to extract values. Where are the coordinates of pixels stored? Commented Oct 30, 2012 at 14:34
  • the coordinates of centroid of pixels are available. Commented Oct 30, 2012 at 15:20
  • 1
    What is their representation? As geometry PostGIS data type? WKT? WKB? Commented Oct 30, 2012 at 15:24
  • yes, geometry type WKT Commented Oct 30, 2012 at 15:36

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.