Currently, the docs for ST_Resample() give options for NearestNeighbor (English or American spelling), Bilinear, Cubic, CubicSpline or Lanczos resampling algorithm.

ref: http://postgis.net/docs/RT_ST_Resample.html

In the same page, they give a link (http://www.gdal.org/gdalwarp.html) to the GDAL warp resampling methods in which average is an option. However, after running it with average as a parameter for the st_resample function, it spit out the same raster (values are the same) with a different pixel size. The funny thing is, running st_valuecount on the two rasters gives the identical number of pixels too which doesn't make sense.

I would like to resample my 10m raster to a 30m raster resolution by calculating the average within each 30m grid. Any ideas?

  • I suppose that if your function is only changing the pixel size there will not happen real resampling but each source pixel is just projected to one target pixel. Try to change also the size of the target image to have more or less rows/columns for kicking the resampling to happen. – user30184 Mar 8 '16 at 21:36

Probably "average" was added to GDAL some time after ST_Resample() was implemented. Fill a ticket in the PostGIS Trac system and they should add it pretty quickly.


Your Answer

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

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