PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ wkblify_band_header()

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

Definition at line 721 of file raster2pgsql.py.

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

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

Referenced by wkblify_raster_level().

Here is the call graph for this function:
Here is the caller graph for this function: