zoukankan      html  css  js  c++  java
  • 计算坡度与坡向

    计算坡度与坡向
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    import subprocess
    
    # SLOPE
    # - To generate a slope map from any GDAL-supported elevation raster :
    # gdaldem slope input_dem output_slope_map"
    # [-p use percent slope (default=degrees)] [-s scale* (default=1)]
    # [-alg ZevenbergenThorne]
    # [-compute_edges] [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q]
    
    create_slope = '''gdaldem slope -co compress=lzw -p ../geodata/092j02_0200_demw.dem ../geodata/slope.tif '''
    
    subprocess.call(create_slope)
    
    # ASPECT
    # - To generate an aspect map from any GDAL-supported elevation raster
    # Outputs a 32-bit float raster with pixel values from 0-360 indicating azimuth :
    # gdaldem aspect input_dem output_aspect_map"
    # [-trigonometric] [-zero_for_flat]
    # [-alg ZevenbergenThorne]
    # [-compute_edges] [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q]
    
    create_aspect = '''gdaldem aspect -co compress=lzw ../geodata/092j02_0200_demw.dem ../geodata/aspect.tif '''
    
    subprocess.call(create_aspect)
    计算山体阴影
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    import subprocess
    
    dem_file = '../geodata/092j02_0200_demw.dem'
    hillshade_relief = '../geodata/hillshade.tif'
    relief = '../geodata/relief.tif'
    final_color_relief = '../geodata/final_color_relief.tif'
    
    create_hillshade = 'gdaldem hillshade -co compress=lzw -compute_edges ' + dem_file +  ' ' + hillshade_relief
    subprocess.call(create_hillshade, shell=True)
    print create_hillshade
    
    cr = 'gdaldem color-relief -co compress=lzw ' + dem_file + ' ramp.txt ' + relief
    subprocess.call(cr)
    print cr
    
    merge = 'python hsv_merge.py ' + relief + ' ' + hillshade_relief + ' ' + final_color_relief
    subprocess.call(merge)
    print merge
    
    create_slope = '''gdaldem slope -co compress=lzw ../geodata/092j02_0200_demw.dem ../geodata/slope_w-degrees.tif '''
    
    subprocess.call(create_slope)
    
    
    # gdaldem hillshade -co compress=lzw -compute_edges -az 315 -alt 60 -z 2 in_relief.asc 315.tif
    # gdaldem hillshade -co compress=lzw -compute_edges -az 275 -alt 60 -z 2 in_relief.asc 275.tif
    # gdaldem hillshade -co compress=lzw -compute_edges -az 355 -alt 60 -z 2 in_relief.asc 355.tif
    # gdaldem hillshade -co compress=lzw -compute_edges -az 135 -alt 60 -z 2 in_relief.asc 135.tif
    # gdaldem slope -co compress=lzw in_relief.asc slope.tif
    # gdaldem color-relief -co compress=lzw slope.tif rampslope.txt slope_col.tif
    # gdaldem color-relief -co compress=lzw in_relief.asc ramp.txt relief_col.tif
  • 相关阅读:
    设置表单输入框中的提示信息
    动感图文轮显
    jquery插件之图片轮显(一)整理2011.02.24
    用sort()方法对数组的元素进行排序(可按字母升序降序与获得最大最小值)
    jquery插件之图片轮显(一)
    jquery插件之图片show and hide(一)
    Pdftk The PDF Toolkit
    error while loading shared libraries: libxcbaux.so.0: cannot open shared object file
    害人的RestoreDirectory
    Oracle CASE WHEN 用法介绍
  • 原文地址:https://www.cnblogs.com/gispathfinder/p/5790469.html
Copyright © 2011-2022 走看看