2

So I need to include the extent of a river into my map, but only have a raster file that shows the outline of the river with a blank (white) background:enter image description here

Is there any way to crop this file so that my result is a raster which includes only the river without the white background so that I can put the layer above for example a ortho and still see the ortho with the river on top?

Alternatively, a raster to vector conversion should work as well, if possible?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
chris3o12
  • 345
  • 1
  • 4
  • 13
  • 1
    Raster to vector tool exists in QGIS, http://manual.linfiniti.com/en/complete_analysis/raster_to_vector.html – Tangnar Sep 16 '15 at 12:37

3 Answers3

2

I would use gdal_translate to add a NODATA value to the raster file. The exact syntax will depend on whether your image is RGB or paletted. For the RGB case, look at this answer. If it's paletted, you can use gdalinfo to get the color indices, then just use

gdal_translate -a_nodata <white_index> src_file out_file

where you substitute the white_index value for the bracketed term

Llaves
  • 5,963
  • 5
  • 31
  • 56
1

because you have the river with white background.
Convert the raster to binary (b,w) and the raster to vector conversion will be very easy.
Using the tool mentioned in comments you should have the solution.

Brad Nesom
  • 17,412
  • 2
  • 42
  • 68
1

You could make the white color in your raster transparent. From the raster layer's properties dialog, select the "Transparency" tab. This tab allows you to add additional transparent colors to your layer. The easiest way to do this is to click the "Add values from display" button on the right (cursor with question mark icon). Then, click one of the white areas in your layer. This will add a new transparent value to the list. Click OK, and all the white areas should become transparent.

ndawson
  • 27,620
  • 3
  • 61
  • 85