How to use GDAL to burn a selected value from one raster into another?

المشرف العام

Administrator
طاقم الإدارة
I think this should be a relatively simple process, but I'm not quite sure how to approach it.

I have a shapefile containing 1000's of polygons. I also have 19 rasters. All of the polygons fall withing the extent of the rasters. The rasters are equal in extent and resolution. Previously I have used GDAL to extract data for each of these polygons from each of the 19 rasters. This worked very well. However, I now wish to extract the pixels into xyz format or similar for all the areas not covered by these polygons.

Currently I am using gdal_rasterize to burn a chosen nodata value into each of the rasters indicating where the polygons occur. I would then need to translate the raster removing all of the nodata values. This is a very heavy process and is taking an awefully long time for 1 raster let alone 19.

My question is - is there a way to gdal_rasterize all of my polygons onto just 1 of the rasters, then use the nodata values from this raster as a mask, and apply these nodata values to the same locations on the other 18 rasters. I'm sure this would be quicker than my current method, but I don't know how to do this in GDAL.

Any help will be very much appreciated!



أكثر...
 
أعلى