[gdal-dev] Transparent lines between raster images when using gdalbuildvrt

Seb Kr sebkr0811 at gmail.com
Tue May 17 06:51:19 PDT 2022


Hello there!

All the files mentioned in this message can be found here:
https://www.swisstransfer.com/d/0722395d-64a4-48fc-8ac9-534e1444fc43

In my company we are currently developing a software in which a user
can input different types of raster images (GTiff/JPG/PNG/etc.). They
can have a different band type, source cs, etc. All these different
types need to be converted to a specific type (rgba, WGS84, GeoTiff
encapsulated in a VRT). We already have an automated process, which
does this quite well. This process uses gdal commands. This VRT will
then further be processed in another application, which needs exactly
this format.

But there is a problem with a specific input, which has the format
JPG/rgb/etrs89. Ssrs info is in this case provided by a .prj-file
(ssrs.prj) by the user. If I look at the end result in QGis
(qgis_result.jpg), there is a transparent line where the two raster
sets meet.

I found out that there is NO transparent line when using one of the
following resampling methods: max, min, med, mode, q1, q3, sum.

When using one of the following resampling methods, there IS a
transparent line: average, bilinear, cubicspline, cubic, lanczos,
near, rms.

The resampling method can be chosen by the user.

The following commands are used (gdal v3.4.3.):

#1. Converting to GeoTiff:

gdal_translate -r cubic -co COMPRESS=LZW -co PREDICTOR=2 left.jpg left.tif
gdal_translate -r cubic -co COMPRESS=LZW -co PREDICTOR=2 right.jpg right.tif

#2. Warping to WGS84, adding an alpha band.

gdalwarp -r cubic -s_srs ssrs.prj -t_srs EPSG:4326 -dstalpha left.tif left.vrt
gdalwarp -r cubic -s_srs ssrs.prj -t_srs EPSG:4326 -dstalpha right.tif right.vrt

#3. Bundling the raster sets.

gdalbuildvrt -r cubic all.vrt *.vrt

(For visualization only) #4. Creating a tif out of the vrt.

gdal_translate -r cubic -co COMPRESS=LZW -co PREDICTOR=2 all.vrt all.tif

It seems to me that the alpha channel has a nodata value at the
overlapping areas. But I'm really not sure what happens here. I really
could use some help.

Why is there a transparent line between the raster tiles?

Thank you and kind regards,
Sebastian


More information about the gdal-dev mailing list