Skip to content

Instantly share code, notes, and snippets.

@RCura
Created November 14, 2012 16:52
Show Gist options
  • Save RCura/4073277 to your computer and use it in GitHub Desktop.
Save RCura/4073277 to your computer and use it in GitHub Desktop.
subprocess / gdalwarp error
# -*- coding: utf-8 -*-
import subprocess
#gdalwarp -q -cutline "/media/robin/DATA/Donnees_M2/monPolygoneLAEA.shp" -crop_to_cutline -dstalpha -of GTiff "/media/robin/DATA/Donnees_M2/popu01clc00v5/popgrid.tif" "/media/robin/DATA/Donnees_M2/popu01clc00v5/popgridCut.tif"
# This command works
polyPath = "/media/robin/DATA/Donnees_M2/monPolygoneLAEA.shp"
rasterPath = "/media/robin/DATA/Donnees_M2/popu01clc00v5/popgrid.tif"
outRasterPath = "/media/robin/DATA/Donnees_M2/popu01clc00v5/popgridCut.tif"
argsSub = ['gdalwarp', '-q', '-cutline' , polyPath, '-crop_to_cutline', '-dstalpha', '-of', 'GTiff', rasterPath, outRasterPath]
subprocess.call(argsSub, shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment