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')

closed as unclear what you're asking by user2856, BERA, Jochen Schwarze, whyzar, Mark Ireland Jan 22 at 15:14

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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 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 at 0:14