计算坡度与坡向

计算坡度与坡向
#!/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

转载于:https://www.cnblogs.com/gispathfinder/p/5790469.html

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值