1

In PostGIS, I have a set of (large, U.S.-wide) rasters at high (30m) resolution. For my application, I need to take an arbitrary area of interest provided by the user, likely ranging in size from dozens to hundreds of raster cells, and then get back out a table containing the values for each cell, in each raster. What I'm ultimately looking for is essentially a normalized table, something like this:

cell_id raster_id raster_value
1 1 10
2 1 3
... ... ...
... ... ...
284 30 .2546

I don't necessarily need each cell to have a unique identifier, but it's important that I know, for example, that the value for raster 1 in a given cell was 0.152, and the value for raster 2 in that same cell was 9.3. I'll ultimately be doing some math to multiply each of those raster values by a user-defined factor, with each of those raster values for a given cell, to get a resulting value for each cell (which could be just tabular info).

I know I can use ST_Value or ST_PixelAsPoint to get the value for a particular pixel, given point input, and I've seen examples for getting summary stats for raster values within a polygon, but no examples that will give back a table or list of values for each raster, for all cells intersecting a polygon, on a cell by cell basis.

2
  • Which is your table schema? Are all raster aligned and have the same size? Are your asking for postgis only solutions? If yes remove the rasterio tag. Jul 9 at 8:55
  • @FranciscoPuga, all rasters are aligned and have the same extent/cell size, etc. At this point, all are rasters, so I don't have a specific table schema, but I would like the results to have an output format as shown in the table. Jul 9 at 13:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.