Skip to content

Automatic raster overviews

rochoa edited this page Oct 1, 2014 · 1 revision

For PostGIS-Rasters-Support, the importer could use 'gdalinfo' to extract the raster size in pixel and then specify overviews as powers of 2 (2,4,8,16...) until the one that would result in a single 256 tile being generated.

Example:

  • gdalinfo HYP_HR.tif | grep '^Size is ' # Size is 21600, 10800
  • take larger dimension: 21600
  • compute max power of 2 needed: ceil(log2(21600/256)) == 7
  • overviews are: 2^1, 2^2, 2^3, 2^4, 2^5, 2^6, 2^7, so: raster2pgsql -l 2,4,8,16,32,64,128

We can play with the parameters to for example stop when we have a 4-tiles coverage: ceil(log2(max_dim/tile_size*max_tiles_per_side))

Clone this wiki locally