3

I have a series of geotiffs which I'm trying to mosaic together, however when they are combined their individual alpha layers overlap sections of the other images and create gaps in the final mosaic:

enter image description here

My approach is first to generate a .vrt from all the geotiffs:

gdalbuildvrt -hidenodata mosaic.vrt geo_pict20140910_131*

And then to convert that .vrt to a geotiff with gdal_translate:

gdal_translate mosaic.vrt mosaic.tif

Is there a way I can mosaic only the non-alpha portions of these geotiffs to avoid these gaps?

Here's a link to the original geotiffs: https://www.dropbox.com/s/udjq9bter9fmgxz/gtiffs.zip?dl=0

Here's a link to the .vrt and final .tif mosaics: https://www.dropbox.com/s/oov9vatz69f31zg/mosaic.zip?dl=0

Here's the gdalinfo for the final mosaic:

Driver: GTiff/GeoTIFF
Files: mosaic.tif
Size is 4782, 2837
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-121.460884208999985,38.583432355500015)
Pixel Size = (0.000000591354474,-0.000000591354474)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-121.4608842,  38.5834324) (121d27'39.18"W, 38d35' 0.36"N)
Lower Left  (-121.4608842,  38.5817547) (121d27'39.18"W, 38d34'54.32"N)
Upper Right (-121.4580564,  38.5834324) (121d27'29.00"W, 38d35' 0.36"N)
Lower Right (-121.4580564,  38.5817547) (121d27'29.00"W, 38d34'54.32"N)
Center      (-121.4594703,  38.5825935) (121d27'34.09"W, 38d34'57.34"N)
Band 1 Block=4782x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA 
Band 2 Block=4782x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA 
Band 3 Block=4782x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA 
Band 4 Block=4782x1 Type=Byte, ColorInterp=Alpha
6

Found a quick solution - replacing "-hidenodata" with "-srcnodata 0" in the .vrt build:

gdalbuildvrt -srcnodata 0 mosaic.vrt geo_pict20140910_131*

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.