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
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
-
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– f.ashouri2012年10月30日 14:28:55 +00:00Commented Oct 30, 2012 at 14:28
-
1The pixels have to have coordinates, otherwise it is impossible to extract values. Where are the coordinates of pixels stored?Vladimir– Vladimir2012年10月30日 14:34:07 +00:00Commented Oct 30, 2012 at 14:34
-
the coordinates of centroid of pixels are available.f.ashouri– f.ashouri2012年10月30日 15:20:31 +00:00Commented Oct 30, 2012 at 15:20
-
1What is their representation? As geometry PostGIS data type? WKT? WKB?Vladimir– Vladimir2012年10月30日 15:24:38 +00:00Commented Oct 30, 2012 at 15:24
-
yes, geometry type WKTf.ashouri– f.ashouri2012年10月30日 15:36:16 +00:00Commented Oct 30, 2012 at 15:36
Explore related questions
See similar questions with these tags.
lang-sql