1

Hello I#m quite new to GDAL. I have some Geotiffs that I want reproject. I tried that with one file and it works great, but because the TIFF has to be slightly rotated for the conversion I have some black areas after that. This is Ok but I have not 1 I have arraound 100 Tiff files and when I built a simple loop with a gdal_warp command for every file I have 100 files with black areas. Is there another command or option where it takes the missing parts from next file ?

  • Welcome to GIS.SE. Can you please edit your question and provide more information about your specific problem. Are you perhaps trying to mosaic adjacent images? What do you mean by "missing parts" and how are they related to the "next file"? Please also consider posting your loop so we can see if the error might be in your code. – Kersten Oct 1 '15 at 14:45
  • There are many ways to handle the nodata areas. For example read again gdal.org/gdalwarp.html and try -dstalpha. If you now open the warped images with QGIS the the black areas have turned into transparent. Some other programs can't deal with alpha channel but they want to know the nodata value -> try with -dstnodata. – user30184 Oct 1 '15 at 15:45
0

Using GDAL at the command line, you can build a virtual raster file to be used by gdalwarp or any other tool:

for %%N in (D:\Karten\gdal\gdal2tiles\NL25\*.tif) DO gdal_translate -of vrt -expand rgba %%N D:\Karten\gdal\gdal2tiles\NL25\%%~nN.vrt
gdalbuildvrt -allow_projection_difference index25.vrt NL25\*.vrt

The first line is only necessary if your data comes with paletted colours.

| improve this answer | |
  • Thanks Andre, so steps are 1. Bulding a virtuell raster (vrt file) from all TIF files and 2. Add a parameter to my gdal_warp loop to let it know the vrt. Or ist there a commandline option like *.tiff for gdal_warp , too ? – Freudi Oct 2 '15 at 7:30
  • You just use the vrt file (index25.vrt in my case) as input for gdalwarp. No loop needed there. – AndreJ Oct 2 '15 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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