669 """Writes WKT Raster header based on given GDAL into HEX-encoded WKB.""" 670 assert ds
is not None,
"Error: Missing GDAL dataset" 672 assert len(ulp) == 2
is not None,
"Error: invalid upper-left corner" 674 if xsize
is None or ysize
is None:
675 assert xsize
is None and ysize
is None 676 xsize = ds.RasterXSize
677 ysize = ds.RasterYSize
682 rt_ip = ( ul[0], ul[1] )
683 rt_skew = ( gt[2], gt[4] )
684 rt_scale = ( gt[1] * level, gt[5] * level )
693 hexwkb +=
wkblify(
'B', options.endian)
695 hexwkb +=
wkblify(
'H', options.version)
697 if options.band
is not None and options.band > 0:
700 hexwkb +=
wkblify(
'H', ds.RasterCount)
703 hexwkb +=
wkblify(
'd', rt_scale[0])
704 hexwkb +=
wkblify(
'd', rt_scale[1])
705 hexwkb +=
wkblify(
'd', rt_ip[0])
706 hexwkb +=
wkblify(
'd', rt_ip[1])
707 hexwkb +=
wkblify(
'd', rt_skew[0])
708 hexwkb +=
wkblify(
'd', rt_skew[1])
709 hexwkb +=
wkblify(
'i', options.srid)
716 logit(
"MSG: Georeference: px = %s -> ul = %s \tresolution = %s \trotation = %s\n" \
717 % (str(ulp), str(rt_ip), str(rt_scale), str(rt_skew)))
def calculate_geoxy(gt, xy)
def get_gdal_geotransform(ds)
def check_hex(hex, bytes_size=None)
def wkblify_raster_header(options, ds, level, ulp, xsize=None, ysize=None)