PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ wkblify()

def raster2pgsql.wkblify (   fmt,
  data 
)
Writes raw binary data into HEX-encoded string using binascii module.

Definition at line 653 of file raster2pgsql.py.

653 def wkblify(fmt, data):
654  """Writes raw binary data into HEX-encoded string using binascii module."""
655  import struct
656 
657  # Binary to HEX
658  fmt_little = '<' +fmt
659  hexstr = binascii.hexlify(struct.pack(fmt_little, data)).upper()
660 
661  # String'ify raw value for log
662  valfmt = '\'' + fmt2printfmt(fmt[len(fmt) - 1]) + '\''
663  val = valfmt % data
664  logit('HEX (\'fmt=%s\', bytes=%d, val=%s):\t\t%s\n' \
665  % (fmt, len(hexstr) / 2, str(val), hexstr))
666 
667  return hexstr
668 
#define str(s)
def logit(msg)
def fmt2printfmt(fmt)
def wkblify(fmt, data)

References fmt2printfmt(), logit(), and str.

Referenced by wkblify_band(), wkblify_band_header(), and wkblify_raster_header().

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