Changeset 4117 for spike/wktraster/scripts/gdal2wktraster.py
- Timestamp:
- 06/02/09 10:34:08 (3 years ago)
- Files:
-
- 1 modified
-
spike/wktraster/scripts/gdal2wktraster.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
spike/wktraster/scripts/gdal2wktraster.py
r4116 r4117 66 66 # UTILITIES 67 67 VERBOSE = False 68 SUMMARY = [] 68 69 69 70 def parse_command_line(): … … 115 116 grp_t.add_option("-I", "--index", dest="index", action="store_true", default=False, 116 117 help="create a GiST index on the raster column") 118 grp_t.add_option("-M", "--vacuum", dest="vacuum", action="store_true", default=False, 119 help="issue VACUUM command against all generated tables") 117 120 grp_t.add_option('-V', '--create-raster-overviews', dest='create_raster_overviews_table', 118 121 action='store_true', default=False, … … 429 432 430 433 return sql 431 434 435 def make_sql_vacuum(table): 436 sql = 'VACUUM FULL ANALYZE ' + quote_sql_name(table) + ';\n' 437 return sql 438 432 439 ################################################################################ 433 440 # RASTER OPERATIONS … … 798 805 799 806 # Write (original) raster to hex binary output 807 tile_count = 0 800 808 hexwkb = '' 801 809 … … 828 836 sql = make_sql_insert_raster(options.table, options.column, hexwkb, options.filename, file) 829 837 options.output.write(sql) 838 tile_count = tile_count + 1 839 840 # SUMMARY for base raster table 841 table_summary = ( options.table, tile_count ) 842 SUMMARY.append( table_summary ) 830 843 831 844 # EOF RASTER … … 869 882 logit("MSG: Processing overview = %s using block = %s as grid = %s\n" % \ 870 883 (str(raster_size), str(block_size), str(grid_size))) 884 885 tile_count = 0 871 886 872 887 for xcell in range(0, grid_size[0]): … … 895 910 sql = make_sql_insert_raster(ov_table, options.column, hexwkb, options.filename, file) 896 911 options.output.write(sql) 897 898 # EOF OVERVIES 912 tile_count = tile_count + 1 913 914 # SUMMARY for overview 915 table_summary = ( ov_table, tile_count ) 916 SUMMARY.append( table_summary ) 917 918 # EOF OVERVIEWS 899 919 900 920 # Cleanup … … 909 929 global VERBOSE 910 930 VERBOSE = opts.verbose 931 932 global SUMMARY 933 SUMMARY = [] 911 934 912 935 saved_out = sys.stdout … … 955 978 opts.output.write('COMMIT;\n') 956 979 980 # VACUUM 981 if opts.vacuum: 982 for s in SUMMARY: 983 sql = make_sql_vacuum(s[0]) 984 opts.output.write(sql) 985 957 986 # Cleanup 958 987 sys.stdout = saved_out 959 988 960 logit("MSG: Number of processed raster files: %d\n" % i) 989 print "------------------------------------------------------------" 990 print " Summary of GDAL to WKT Raster processing:" 991 print "------------------------------------------------------------" 992 print "Number of processed raster files: %d" % i 993 print "List of generated tables (number of tiles):" 994 i = 0 995 for s in SUMMARY: 996 i += 1 997 print "%d\t%s (%d)" % (i, s[0], s[1]) 961 998 962 999 ################################################################################
