729def wkblify_band_header(options, band):
730 """Writes band header into HEX-encoded WKB"""
731 assert band is not None, "Error: Missing GDAL raster band"
732
733 hexwkb = ""
734
735 first4bits = 0
736
737
738 if options.register:
739 first4bits = 128
740
741 nodata = band.GetNoDataValue()
742
743 if nodata is not None:
744 first4bits += 64
745 else:
746 nodata = 0
747
748
749 pixtype = gdt2pt(band.DataType)['id']
750 hexwkb += wkblify('B', pixtype + first4bits)
751
752
753 hexwkb += wkblify(pt2fmt(pixtype), nodata)
754
755 check_hex(hexwkb)
756 return hexwkb
757