Show
Ignore:
Timestamp:
05/20/09 03:42:57 (3 years ago)
Author:
mloskot
Message:

[wktraster] Added -V, --create-raster-overviews option to gdal2wktraster script. It allows to control creation of RASTER_OVERVIEWS table for overviews metadata.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • spike/wktraster/scripts/gdal2wktraster.py

    r4088 r4090  
    9797    grp_r.add_option("-R", "--register", dest="register", action="store_true", default=False,  
    9898                     help="register the raster as a filesystem (out-db) raster") 
    99     grp_r.add_option("-O", "--overviews", dest="overviews", action="store_true", default=False,  
    100                      help="Create overview tables named as ov_<RASTER TABLE>_<LEVEL> and populate with GDAL-provided overviews (available for regular blocking only)") 
     99    grp_r.add_option("-O", "--overviews", dest="overviews", action="store_true", default=False, 
     100                     help='Create overview tables named as ov_<RASTER TABLE>_<LEVEL> and ' 
     101                     'populate with GDAL-provided overviews (regular blocking only)') 
    101102    prs.add_option_group(grp_r); 
    102103 
    103104    # Optional parameters - database/table manipulation 
    104     grp_t = OptionGroup(prs, "Database processing", 
    105                         "Optional parameters used to manipulate database objects") 
    106     grp_t.add_option("-c", "--create", dest="create_table", action="store_true", default=False,  
    107                      help="create new table and populate it with raster(s), this is the default mode") 
     105    grp_t = OptionGroup(prs, 'Database processing', 
     106                        'Optional parameters used to manipulate database objects') 
     107    grp_t.add_option('-c', '--create', dest='create_table', action='store_true', default=False,  
     108                     help='create new table and populate it with raster(s), this is the default mode') 
    108109    grp_t.add_option("-d", "--drop", dest="drop_table", action="store_true", default=False,  
    109110                     help="drop table, create new one and populate with raster(s)") 
     
    114115    grp_t.add_option("-I", "--index", dest="index", action="store_true", default=False,  
    115116                     help="create a GiST index on the raster column") 
     117    grp_t.add_option('-V', '--create-raster-overviews', dest='create_raster_overviews_table', 
     118                     action='store_true', default=False, 
     119                     help='create RASTER_OVERVIEWS table used to store overviews metadata') 
    116120    prs.add_option_group(grp_t); 
    117121 
     
    152156    if opts.overviews and not opts.regular_blocking: 
    153157        prs.error("regular blocking mode required to enable overviews support") 
     158 
     159    if opts.create_raster_overviews_table and opts.overviews is False: 
     160        prs.error('create table for RASTER_OVERVIEWS available only if overviews import requested') 
    154161 
    155162    # XXX: Now, if --band=Nth, then only Nth band of all specified rasters is dumped/imported 
     
    826833    # Process raster overviews to hex binary, if requested 
    827834    # 1. Recalculate grid size per overview, using original block size 
    828     # 2. Tile overview bands according to original block size 
     835    # 2. Tile overview bands according to original block size, 
     836    #    add padding pixels/scanlines if necessary 
    829837    if options.regular_blocking is True and options.overviews is True: 
    830838        assert options.filename is False,'No support for off-db overviews' 
     
    911919 
    912920    # If overviews requested, CREATE TABLE raster_overviews 
    913     if opts.overviews: 
     921    if opts.create_raster_overviews_table: 
    914922        sql = make_sql_create_raster_overviews(opts) 
    915923        opts.output.write(sql)