Ignore:
Timestamp:
Jan 13, 2019, 5:00:46 PM (8 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
403e4ed
Parents:
883b4a5
Message:

Extended log-analyser to create tiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/python/bin/gnuboat-log-analyser

    r883b4a5 r26d66d8  
    22# -*- coding: utf-8 -*-
    33'''
    4     Copyright (C) 2018 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
     4    Copyright (C) 2018 - 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
    55
    66    This program is free software: you can redistribute it and/or modify
    … …  
    246246        print("  Created color relief in {}".format(gdal_file_color_relief))
    247247       
    248         # slope shade
     248        # slopeshade
    249249        gdal_file_slope_shade_tmp = "/vsimem/tmp_water_depth_slope_shade.tif"
    250250        gdal_file_slope_shade = os.path.join(output_directory, "water_depth_slope_shade.tif")
    … …  
    259259       
    260260        # generate contour lines
     261        # @todo not useful in this configuration!
    261262        contour_input = gdal.Open(gdal_file, gdalconst.GA_ReadOnly)
    262263        contour_input_band = contour_input.GetRasterBand(1)
    … …  
    276277        del contour_output
    277278
     279        # generate tiles
     280        tile_zoom_option = "0-19"
     281        tile_commands = [
     282                #hillshade
     283                {"file": gdal_file_hillshade, "title": 'Hillshade', "output": 'hillshade'},
     284                #color relief
     285                {"file": gdal_file_color_relief, "title": 'Color relief', "output": 'color_relief'},
     286                #slopeshade
     287                {"file": gdal_file_slope_shade, "title": 'Slopeshade', "output": 'slopeshade'}
     288        ]
     289        print("Expanding {} tifs to tiles".format(len(tile_commands)))
     290        for tile_command in tile_commands:
     291                title = tile_command["title"]
     292                output = os.path.join(output_directory, tile_command["output"])
     293                os.system('gdal2tiles.py -q -w none -z {} -t "GNUBoat {}" {} {}'.format(tile_zoom_option, title, tile_command["file"], output))
     294                print("  Created tiles for {} in {}".format(title, output))
     295
    278296        sys.exit(0)
    279297
Note: See TracChangeset for help on using the changeset viewer.