830 assert ds
is not None 832 assert len(band_range) == 2
834 band_from = band_range[0]
835 band_to = band_range[1]
838 raster_size = ( ds.RasterXSize, ds.RasterYSize )
839 if options.block_size
is not None:
841 read_block_size = ( block_size[0] * level, block_size[1] * level)
844 block_size = raster_size
845 read_block_size = block_size
848 logit(
"MSG: Processing raster=%s using read_block_size=%s block_size=%s of grid=%s in level=%d\n" % \
849 (str(raster_size), str(read_block_size), str(block_size), str(grid_size), level))
853 if i == 0
and options.create_table:
855 pixel_size = ( gt[1], gt[5] )
860 pixel_size, block_size, extent)
861 options.output.write(sql)
862 gen_table = options.table
869 level_table_name =
'o_' + str(level) +
'_' + schema_table_names[1]
870 level_table = schema_table_names[0] +
'.' + level_table_name
873 options.output.write(sql)
875 options.output.write(sql)
876 gen_table = level_table
882 for ycell
in range(0, grid_size[1]):
883 for xcell
in range(0, grid_size[0]):
885 xoff = xcell * read_block_size[0]
886 yoff = ycell * read_block_size[1]
888 logit(
"MSG: --------- CELL #%04d\tindex = %d x %d\tdim = (%d x %d)\t(%d x %d) \t---------\n" % \
889 (tile_count, xcell, ycell, xoff, yoff, xoff + read_block_size[0], yoff + read_block_size[1]))
891 if options.block_size
is not None:
894 block_size[0], block_size[1])
898 for b
in range(band_from, band_to):
899 band = ds.GetRasterBand(b)
900 assert band
is not None,
"Missing GDAL raster band %d" % b
901 logit(
"MSG: Band %d\n" % b)
904 hexwkb +=
wkblify_band(options, band, level, xoff, yoff, read_block_size, block_size, infile, b)
909 options.output.write(sql)
911 tile_count = tile_count + 1
913 return (gen_table, tile_count)
def make_sql_register_overview(options, ov_table, ov_factor)
def collect_nodata_values(ds, band_from, band_to)
def collect_pixel_types(ds, band_from, band_to)
def parse_block_size(options)
def get_gdal_geotransform(ds)
def wkblify_band(options, band, level, xoff, yoff, read_block_size, block_size, infile, bandidx)
def calculate_bounding_box(ds, gt)
def make_sql_create_table(options, table=None, is_overview=False)
def wkblify_band_header(options, band)
def wkblify_raster_level(options, ds, level, band_range, infile, i)
def make_sql_insert_raster(table, rast, hexwkb, insert_filename, file)
def calculate_grid_size(raster_size, block_size)
def make_sql_schema_table_names(schema_table)
def check_hex(hex, bytes_size=None)
def make_sql_addrastercolumn(options, pixeltypes, nodata, pixelsize, blocksize, extent)
def wkblify_raster_header(options, ds, level, ulp, xsize=None, ysize=None)