831 assert ds
is not None
833 assert len(band_range) == 2
835 band_from = band_range[0]
836 band_to = band_range[1]
839 raster_size = ( ds.RasterXSize, ds.RasterYSize )
840 if options.block_size
is not None:
842 read_block_size = ( block_size[0] * level, block_size[1] * level)
845 block_size = raster_size
846 read_block_size = block_size
849 logit(
"MSG: Processing raster=%s using read_block_size=%s block_size=%s of grid=%s in level=%d\n" % \
850 (
str(raster_size),
str(read_block_size),
str(block_size),
str(grid_size), level))
854 if i == 0
and options.create_table:
856 pixel_size = ( gt[1], gt[5] )
861 pixel_size, block_size, extent)
862 options.output.write(sql)
863 gen_table = options.table
870 level_table_name =
'o_' +
str(level) +
'_' + schema_table_names[1]
871 level_table = schema_table_names[0] +
'.' + level_table_name
874 options.output.write(sql)
876 options.output.write(sql)
877 gen_table = level_table
883 for ycell
in range(0, grid_size[1]):
884 for xcell
in range(0, grid_size[0]):
886 xoff = xcell * read_block_size[0]
887 yoff = ycell * read_block_size[1]
889 logit(
"MSG: --------- CELL #%04d\tindex = %d x %d\tdim = (%d x %d)\t(%d x %d) \t---------\n" % \
890 (tile_count, xcell, ycell, xoff, yoff, xoff + read_block_size[0], yoff + read_block_size[1]))
892 if options.block_size
is not None:
895 block_size[0], block_size[1])
899 for b
in range(band_from, band_to):
900 band = ds.GetRasterBand(b)
901 assert band
is not None,
"Missing GDAL raster band %d" % b
902 logit(
"MSG: Band %d\n" % b)
905 hexwkb +=
wkblify_band(options, band, level, xoff, yoff, read_block_size, block_size, infile, b)
910 options.output.write(sql)
912 tile_count = tile_count + 1
914 return (gen_table, tile_count)
def check_hex(hex, bytes_size=None)
def make_sql_create_table(options, table=None, is_overview=False)
def make_sql_insert_raster(table, rast, hexwkb, insert_filename, file)
def wkblify_raster_level(options, ds, level, band_range, infile, i)
def wkblify_raster_header(options, ds, level, ulp, xsize=None, ysize=None)
def parse_block_size(options)
def wkblify_band_header(options, band)
def make_sql_register_overview(options, ov_table, ov_factor)
def get_gdal_geotransform(ds)
def make_sql_addrastercolumn(options, pixeltypes, nodata, pixelsize, blocksize, extent)
def make_sql_schema_table_names(schema_table)
def calculate_bounding_box(ds, gt)
def calculate_grid_size(raster_size, block_size)
def collect_nodata_values(ds, band_from, band_to)
def wkblify_band(options, band, level, xoff, yoff, read_block_size, block_size, infile, bandidx)
def collect_pixel_types(ds, band_from, band_to)