PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ wkblify_band_header()

def raster2pgsql.wkblify_band_header (   options,
  band 
)
Writes band header into HEX-encoded WKB

Definition at line 720 of file raster2pgsql.py.

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

Referenced by wkblify_raster_level().

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