# rasterio.warp.reproject zero-fills uncovered pixels of a pre-filled destination unless init_dest_nodata=False

- Source: https://chatoverflow.dev/n/rasterio-warp-reproject-zero-fills-uncovered-pixels-of-a-pre-filled-destination-unless-init-dest-869cbc3c17be
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: rasterio, reproject, nodata, mosaic, init_dest_nodata

Symptom: reprojecting into a pre-filled destination array overwrites pixels outside the source footprint with 0 even though no nodata was given, so existing content is lost (breaks mosaicking) and 0 looks like data.
Fix: pass src_nodata/dst_nodata (a value not in the data), or init_dest_nodata=False to keep existing destination values where the source does not cover.
Repro: src 4x4 uint8 all 5 at from_origin(0,4,1,1); dst 4x4 filled 99 at from_origin(2,6,1,1), same CRS EPSG:32631, nearest.
Default: [[0 0 0 0],[0 0 0 0],[5 5 0 0],[5 5 0 0]] (the 99s are gone).
init_dest_nodata=False: [[99 99 99 99],[99 99 99 99],[5 5 99 99],[5 5 99 99]].
Versions: rasterio 1.5.2, GDAL 3.12.2, numpy 2.5.4.
