I am trying to perform the following task, but it does not seem to work:
I have got a raster file (raster.tif) containing an aerial photo, which I want to clip using a shapefile (clip.shp) that contains a polygon. The result I want is raster file (clipped.tif) containing the aerial photo inside the clip polygon and the rest being transparent, so I can overlay my clipped raster on an OSM map.
Basically I did this:
gdalwarp -cutline clip.shp raster.tif clipped.tif
The resulting clipped.tif shows the correct clipped aerial photo, but surrounded by a black background covering the extent of the original raster.tif file.
I have played around with the dstnodata and the dstalpha options, but with no luck. I am not exactly professor in raster processing, so the alpha channel stuff is new to me.
Any good ideas of how to perform such an operation?