I have a GeoTIFF file that corresponds to terrain data (SRTM 3-arc data). I need to do 3 things;

  1. Crop a specific area of ​​the raster and
  2. Literally move the raster to another coordinate of lat and lon.
  3. Save it into new GeoTIFF

For example, if it were a set of islands, cut only one, and move it to another location in the world.

I have QGIS for iMac.

  • 1
    you could use gdal_translate (gdal.org/programs/gdal_translate.html) -projwin option to extract a subset of your raster to a format like a bitmap (-of BMP) which will create a world file (.bpw) which you can edit the parameters manually then convert the bitmap to a geoTIFF with gdal_translate -of GTIFF. I know it's a bit of a hack but it works. You have no tags or mention of an API or programming language to offer a code solution; GDAL_Translate is available through QGIS as Raster::Translate. – Michael Stimson Sep 11 '19 at 3:44
  • Have you checked the answers of previous questions on this site? What you are asking for was answered many times on separate questions. Please do your research first and if you stuck somewhere during the process please give us a detailed description. – ahmadhanb Sep 11 '19 at 6:03

I got the first step, crop a specific area of ​​the raster with:

gdal_translate -a_srs EPSG:4326 -projwin -17.1 28.725 -15.998 27.895 srtm_33_07.tif final.tif

Then I convert GeoTIFF file to BMP with:

gdal_translate -a_srs EPSG:4326 -of BMP final.tif out.bmp

and it generates that error ->

Input file size is 1322, 996 0ERROR 1: Attempt to create BMP dataset with an illegal data type (Int16), only Byte supported by the format.

I tried this other way, but it doesn't generate the .bpw file

gdal_translate -a_srs EPSG:4326 -of BMP -ot Byte final.tif output.bmp

The file that contains the information "output.bmp.aux.xml", does not display it in lat/lon coordinates ->

GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]] -1.7100000000000001e+01, 8.3333333333333339e-04, 0.0000000000000000e+00, 2.8725000000000001e+01, 0.0000000000000000e+00, -8.3333333333333339e-04 Area -3.27680000000000E+04 Gray

I think I would first have to solve this (I tried several things, but I can't solve it). Then I will enter the "new coordinates" where to locate this 3-arc SRTM data fragment in the * bmp.aux.xml file and then i will convert it to GeoTIFF.

Any indication regarding this??...

Not the answer you're looking for? Browse other questions tagged or ask your own question.