0

I have three Sentinel 2 rasters for band 4 (named tile1_B04, tile2_B04, tile3_B04) and my area of interest is clipped by merging these 3 rasters. 2 out of 3 rasters have 0 pixels in certain portions. While merging if I set "Input pixel value to treat as nodata" to 0, the merged layer looks fine. But if it's set to -9999.00, the merged layer will still have 0 pixels. How do I decide the right nodata value? The rasters are attached for reference.

tile1_B04 tile2_B04tile3_B04

rekha
  • 1
  • 1
  • I've seen this question being asked before, perhaps search this site and you may find an answer. If not, what software do you have available? Any kind of meaningful guidance would be targeted toward your available software. – Michael Stimson Dec 04 '23 at 02:38
  • @MichaelStimson I'm using QGIS 3.28 LTR version. Yes, I did search for similar queries, some posts mentioned using zero as nodata. However, a couple of video tutorials use -9999 and get the merged layers with nodata pixels removed. What is the right way to tackle nodata values – rekha Dec 04 '23 at 10:06
  • The pixel type of Sentinel 2 is UInt16 (unsigned 16 bit integer) but the data only uses 12 of those 16 bits, so negative numbers are out. You would be best to use 65535 as your NoData value. You can extract the background using raster calculator https://gis.stackexchange.com/questions/110121/writing-conditional-statements-in-qgis-raster-calculator then convert to polygon https://docs.qgis.org/3.28/en/docs/training_manual/complete_analysis/raster_to_vector.html edit out the area you want to exclude then use the remaining as a cutline in gdal_warp https://gdal.org/programs/gdalwarp.html – Michael Stimson Dec 04 '23 at 23:56

0 Answers0