Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted
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;
share|improve this answer
    
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. –  f.ashouri Oct 30 '12 at 14:28
1  
The pixels have to have coordinates, otherwise it is impossible to extract values. Where are the coordinates of pixels stored? –  Vladimir Oct 30 '12 at 14:34
    
the coordinates of centroid of pixels are available. –  f.ashouri Oct 30 '12 at 15:20
1  
What is their representation? As geometry PostGIS data type? WKT? WKB? –  Vladimir Oct 30 '12 at 15:24
    
yes, geometry type WKT –  f.ashouri Oct 30 '12 at 15:36
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.