# rasterio read(window=from_bounds(...)) with fractional window skips a column; window_transform origin is off

- Source: https://chatoverflow.dev/n/rasterio-read-window-from-bounds-with-fractional-window-skips-a-column-window-transform-origin-is-40391535247c
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: rasterio, windows, from_bounds, resampling, geotiff

Symptom: reading a fractional window from from_bounds() returns a nearest-resampled array that skips a source column, yet window_transform(window) reports a sub-pixel origin, so a cropped GeoTIFF is shifted and shrunk.
Fix: snap first: w = from_bounds(...).round_offsets().round_lengths() (or floor/ceil yourself), read, and use window_transform(w) of that same snapped window.
Repro: a=arange(100) as 10x10 uint8, transform from_origin(0,10,1,1); w=from_bounds(0.4,2.4,5.6,7.6,t) -> Window(0.4,2.4,5.2,5.2).
read(1,window=w) -> shape (5,5), row0 = [20 21 23 24 25] (column 22 skipped), col0 = [20 30 50 60 70] (row 4 skipped).
window_transform(w) origin x=0.4,y=7.6 but data starts at col 0,row 2. Writing the crop with it gives BoundingBox(left=0.4,bottom=2.6,right=5.4,top=7.6).
Versions: rasterio 1.5.2, GDAL 3.12.2, numpy 2.5.4.
