Changeset 403e4ed for src/python


Ignore:
Timestamp:
Jan 13, 2019, 6:17:04 PM (8 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
9e4d815
Parents:
26d66d8
Message:
  • renamed slope_shade to slopeshade
  • added addAlpha option to all DEMProcessings, but this option only supported in GDal >= 2.3
File:
1 edited

Legend:

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

    r26d66d8 r403e4ed  
    243243                for depth in colors:
    244244                        color_config.write("{} {}\n".format(depth, colors[depth]))
    245         gdal.DEMProcessing(gdal_file_color_relief, gdal_file, "color-relief", options = gdal.DEMProcessingOptions(format = "GTiff", colorFilename = gdal_file_color_relief_config))
     245        gdal.DEMProcessing(gdal_file_color_relief, gdal_file, "color-relief", options = gdal.DEMProcessingOptions(format = "GTiff", colorFilename = gdal_file_color_relief_config), addAlpha = True)
    246246        print("  Created color relief in {}".format(gdal_file_color_relief))
    247247       
    248248        # slopeshade
    249         gdal_file_slope_shade_tmp = "/vsimem/tmp_water_depth_slope_shade.tif"
    250         gdal_file_slope_shade = os.path.join(output_directory, "water_depth_slope_shade.tif")
    251         gdal_file_slope_shade_config = os.path.join(output_directory, "tmp_water_depth_slope_shade_config.txt")
    252         with open(gdal_file_slope_shade_config, 'w') as shade_config:
     249        gdal_file_slopeshade_tmp = "/vsimem/tmp_water_depth_slopeshade.tif"
     250        gdal_file_slopeshade_config = os.path.join(output_directory, "tmp_water_depth_slopeshade_config.txt")
     251        with open(gdal_file_slopeshade_config, 'w') as shade_config:
    253252                shade_config.write("0 255 255 255\n")
    254253                shade_config.write("90 0 0 0\n")
    255         gdal.DEMProcessing(gdal_file_slope_shade_tmp, gdal_file, "slope", options = gdal.DEMProcessingOptions(format = "GTiff"))
    256         gdal.DEMProcessing(gdal_file_slope_shade, gdal_file_slope_shade_tmp, "color-relief", options = gdal.DEMProcessingOptions(format = "GTiff", colorFilename = gdal_file_slope_shade_config))
    257         print("  Created slope shade in {}".format(gdal_file_slope_shade))
     254        gdal.DEMProcessing(gdal_file_slopeshade_tmp, gdal_file, "slope", options = gdal.DEMProcessingOptions(format = "GTiff"), slopeFormat = 'degree', zeroForFlat = True, addAlpha = True)
     255        gdal.DEMProcessing(gdal_file_slopeshade, gdal_file_slopeshade_tmp, "color-relief", options = gdal.DEMProcessingOptions(format = "GTiff", colorFilename = gdal_file_slopeshade_config), addAlpha = True)
     256        print("  Created slope shade in {}".format(gdal_file_slopeshade))
    258257       
    259258       
    260259        # generate contour lines
    261         # @todo not useful in this configuration!
     260        # @todo Cut Tifs / warp
    262261        contour_input = gdal.Open(gdal_file, gdalconst.GA_ReadOnly)
    263262        contour_input_band = contour_input.GetRasterBand(1)
    … …  
    276275        contour_output = None
    277276        del contour_output
     277       
     278        #overlaid = gdal.Warp(gdal_file_slopeshade, [color_relief, hillshade], format='GTiff')
     279        ##gdal.Translate(gdal_file_slopeshade, overlaid, creationOptions=['compress=LZW', 'alpha=yes'])
     280        #gdal.Translate(gdal_file_slopeshade, overlaid, creationOptions=['alpha=yes'])
     281        gdal.Warp('/tmp/gnuboat/test.tif', gdal_file_color_relief, options = gdal.WarpOptions(format = 'GTiff', dstAlpha = True, cutlineDSName = '/tmp/gnuboat/contours/contour-0.shp'))
     282        #gdal.Warp('/tmp/gnuboat/test.tif', gdal_file_color_relief, options = gdal.WarpOptions(format = 'GTiff', dstAlpha = True))
    278283
    279284        # generate tiles
    … …  
    285290                {"file": gdal_file_color_relief, "title": 'Color relief', "output": 'color_relief'},
    286291                #slopeshade
    287                 {"file": gdal_file_slope_shade, "title": 'Slopeshade', "output": 'slopeshade'}
     292                {"file": gdal_file_slopeshade, "title": 'Slopeshade', "output": 'slopeshade'}
    288293        ]
    289294        print("Expanding {} tifs to tiles".format(len(tile_commands)))
Note: See TracChangeset for help on using the changeset viewer.