This question already has an answer here:

How I can to draw using GDAL in python or c a polygon shapefile shape.shp with a GeoTIFF as background background.tiff file?

Both files are in the same projection.

The result could be a PNG, JPEG or whatever. To clarify I'm going to put screen shoots of the done with QGIS. First one is the shapefile, second the GeoTIFF, and finally the union.

Shapefile File

GeoTIFF file

GeoTIFF as background and shape as shadow

marked as duplicate by user30184, Midavalo Mar 16 '17 at 20:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Are you wanting this to be scripted, or a one time thing? – Alec Bennett Mar 16 '17 at 19:43
  • @AlecBennett scripted or c coded – Mquinteiro Mar 16 '17 at 19:44
  • 2
    Add alpha to the gdal_rasterize command as in here gis.stackexchange.com/questions/176471/…. There are other usable answers as well, search with "gdal_rasterize". – user30184 Mar 16 '17 at 19:48
  • @user30184 It's look similar, I'm going to test it. Thanks. – Mquinteiro Mar 16 '17 at 20:02

One method would be to rasterize the shapefile using gdal_rasterize, and then overlay it onto the other raster file.

A similar question exists and is available here: how to overlay shapefile and raster?

Not the answer you're looking for? Browse other questions tagged or ask your own question.