PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ calculate_block_size()

def raster2pgsql.calculate_block_size (   ds,
  band_from,
  band_to 
)
Size of natural block reported by GDAL for bands of given dataset

Definition at line 542 of file raster2pgsql.py.

542 def calculate_block_size(ds, band_from, band_to):
543  """Size of natural block reported by GDAL for bands of given dataset"""
544 
545  block_dims = None
546  for i in range(band_from, band_to):
547  band = ds.GetRasterBand(i)
548  assert band is not None, "Cannot access raster band %d" % i
549  dims = band.GetBlockSize()
550 
551  # Assume bands with common block size
552  if i == band_from:
553  block_dims = dims
554 
555  # Validate dimensions of bands block
556  if block_dims != dims:
557  logit("MSG: Block sizes don't match: %s != %s\n" % (str(block_dims), str(dims)))
558 
559  assert block_dims is not None, "Failed to calculate block size"
560  return (int(block_dims[0]), int(block_dims[1]))
561 
#define str(s)
def logit(msg)
def calculate_block_size(ds, band_from, band_to)

References logit(), and str.

Here is the call graph for this function: