5

In my project when raster layers are overlapping a white band appears the edge of the top layer.

How can I remove it and obtain a seamless overlapping of the raster ?

(I have try to built a vrt with those layers but the with bands remained)

I am working with QGIS 2.4

Here is a example of the phenomena (each layer has 10% transparency) white band on overlapping raster

Here is the gdalinfo output of one of the raster Driver: GTiff/GeoTIFF Files: /vdata/scot_009h_georef.tif Size is 5985, 2349 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 = (-3.873394354081865,58.119237085214102) Pixel Size = (0.000601740178426,-0.000601740178426) Metadata: AREA_OR_POINT=Area Image Structure Metadata: COMPRESSION=LZW INTERLEAVE=PIXEL Corner Coordinates: Upper Left ( -3.8733944, 58.1192371) ( 3d52'24.22"W, 58d 7' 9.25"N) Lower Left ( -3.8733944, 56.7057494) ( 3d52'24.22"W, 56d42'20.70"N) Upper Right ( -0.2719794, 58.1192371) ( 0d16'19.13"W, 58d 7' 9.25"N) Lower Right ( -0.2719794, 56.7057494) ( 0d16'19.13"W, 56d42'20.70"N) Center ( -2.0726869, 57.4124932) ( 2d 4'21.67"W, 57d24'44.98"N) Band 1 Block=5985x1 Type=Byte, ColorInterp=Red NoData Value=0 Band 2 Block=5985x1 Type=Byte, ColorInterp=Green NoData Value=0 Band 3 Block=5985x1 Type=Byte, ColorInterp=Blue NoData Value=0

  • Is it always white? (255,255,255) You can use srcnodata in the building of the VRT. – Michael Stimson Jul 23 '14 at 1:54
  • Can you edit your question and add a gdalinfo report for one of the rasters. – user2856 Jul 23 '14 at 11:21
  • @MichaelMiles-Stimson: Yes, the edge is always white. One borders almost each raster. – kFly Jul 23 '14 at 20:06
  • 1
    Have you tried adding a no data value (perhaps 255, maybe 0) in the raster properties transparency setting? – johns Jul 23 '14 at 20:21
  • 1
    This might help: gis.stackexchange.com/questions/25023/… I know ArcMap has a customization that provides for a default display of background and no data values, but a quick look at my QGIS didn't show that option. Others probably know better. – johns Jul 23 '14 at 21:10
3

Option 1

You have discovered one option - adding 255 to the "Additional No Value" in Layer Properties/Transparency.

Option 2

Another option is to use a VRT, define 255 as the source nodata value and define 0 as the VRT no data value using gdalbuildvrt.

For example:

gdalbuildvrt -srcnodata 255 -vrtnodata 0 out.vrt in.tif

To do this on all tiffs in a folder, use something like the following (assuming you are using a bash shell on OSX/Linux/Unix based on the path in your gdalinfo output):

for f in *.tif; do gdalbuildvrt -srcnodata 255 -vrtnodata 0 "${f%.*}".vrt "$f";  done

Option 3

A third option that will actually crop the white collars permanently and not turn non-collar white pixels to NoData is the GDAL nearblack utility.

For example:

nearblack -of gtiff -nb 0 -color white -near 0 -o decollar.tif collar.tif

To do this on all tiffs in a folder, use something like the following:

for f in *.tif; do nearblack -of gtiff -nb 0 -color white -near 0 -o "${f%.*}"-decollared.tif "$f";  done

Note "${f%.*}" is bash parameter expansion syntax to get the filename without the extension.

  • Actually adding 255 in "Additionnal No Value" in the layer worked only for the individual layer, and in the project overview. When I built the VRT afterwards, the white lines came back. I will try your proposal when I get again access to the computer in 2 weeks. My other concern is by doing this, I alter the content of the raster deleting the real white inside the raster, whereas the white borders are not present in the individual raster but only around the area where 2 rasters overlap, and on the top layer. Is this concern relevant ? – kFly Jul 24 '14 at 21:11
  • @FlyingGman Yes, that's because the "Additionnal No Value" is a per-layer setting. Yes, all white values will be set as NoData. I've edited my question to add another option. – user2856 Jul 24 '14 at 23:59
  • I found the origin of these white border: in the initial jpg scan a fine white border of 45 pixels was included during in the scan process by the machine. After georeferencing, this border is a bit deformed. Once all the files have been georeferenced, it is too time consuming the crop the individual raster and restart the georeferencing. I think your option 3 can work, I need to find a color not present in the raster to fill this border, and set this value to no value as you explained. – kFly Aug 22 '14 at 22:00

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.