2

When I use gdal_translate to crop the GeoTiff file, the output file is saving the same as the input file. Nothing changed. The size needs to decrease at the boundaries I specify. What can I do?

from osgeo import gdal
import os  

os.system('gdal_translate -projwin 3046477.80 4645536.98 3046546.08 4645571.24 input.tif output.tif')
  • 3
    Please edit your question and include the output of gdalinfo input.tif and gdalinfo output.tif. Additionally, please run your gdal_translate etc... command from the command prompt, not from python, just to assist with debugging (and include the output). Once you get the command working, you can go back to using it from python. – user2856 Jan 20 '19 at 23:43
  • 1
    On a side note, os.system is being depreciated mail.python.org/pipermail/python-dev/2010-July/102427.html, consider using subprocess.Popen(['gdal_translate', '-projwin', '3046477.80', '4645536.98', '3046546.08', '4645571.24', 'input.tif', 'output.tif']).wait() instead docs.python.org/2/library/subprocess.html. – Michael Stimson Jan 21 '19 at 0:14