PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ wkblify_band_header()

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

Definition at line 729 of file raster2pgsql.py.

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 # If the register option is enabled, set the first bit to 1
738 if options.register:
739 first4bits = 128
740
741 nodata = band.GetNoDataValue()
742 # If there is no nodata value, set it to 0. Otherwise set the HasNodata bit to 1
743 if nodata is not None:
744 first4bits += 64
745 else:
746 nodata = 0
747
748 # Encode pixel type
749 pixtype = gdt2pt(band.DataType)['id']
750 hexwkb += wkblify('B', pixtype + first4bits)
751
752 # Encode nodata value (or Zero, if nodata unavailable)
753 hexwkb += wkblify(pt2fmt(pixtype), nodata)
754
755 check_hex(hexwkb)
756 return hexwkb
757