# 如何利用 GDAL-Python裁剪栅格数据（DEM等）2019

ARCGIS裁剪数据量比较大的栅格很容易卡死，故用gdal。

from osgeo import gdal

input_raster = r"F:\JUNK\dem90.tif"
# or as an alternative if the input is already a gdal raster object you can use that gdal object
input_raster=gdal.Open(input_raster)
input_shape = r"F:\JUNK\gla-shp.shp" # or any other format
ds=None     #do other stuff with ds object, it is your cropped dataset. in this case we only close the dataset.