PostGIS  2.1.10dev-r@@SVN_REVISION@@
def raster2pgsql.wkblify_band_header (   options,
  band 
)
Writes band header into HEX-encoded WKB

Definition at line 722 of file raster2pgsql.py.

References check_hex(), gdt2pt(), pt2fmt(), and wkblify().

Referenced by wkblify_raster_level().

722 def wkblify_band_header(options, band):
723  """Writes band header into HEX-encoded WKB"""
724  assert band is not None, "Error: Missing GDAL raster band"
725 
726  hexwkb = ""
727 
728  first4bits = 0
729 
730  # If the register option is enabled, set the first bit to 1
731  if options.register:
732  first4bits = 128
733 
734  nodata = band.GetNoDataValue()
735  # If there is no nodata value, set it to 0. Otherwise set the HasNodata bit to 1
736  if nodata is not None:
737  first4bits += 64
738  else:
739  nodata = 0
740 
741  # Encode pixel type
742  pixtype = gdt2pt(band.DataType)['id']
743  hexwkb += wkblify('B', pixtype + first4bits)
744 
745  # Encode nodata value (or Zero, if nodata unavailable)
746  hexwkb += wkblify(pt2fmt(pixtype), nodata)
747 
748  check_hex(hexwkb)
749  return hexwkb
750 
def gdt2pt(gdt)
def pt2fmt(pt)
def wkblify(fmt, data)
def wkblify_band_header(options, band)

Here is the call graph for this function:

Here is the caller graph for this function: