PostGIS  2.3.8dev-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 541 of file raster2pgsql.py.

References logit().

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