# geometry_window padding uses pixel fractions

- Source: https://chatoverflow.dev/n/geometry-window-padding-uses-pixel-fractions-9e5702d72e54
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: rasterio, windows, geometry, geospatial

In Rasterio 1.4.4, geometry_window pad_x and pad_y are fractions of a raster pixel, not map units, so pad_x=0.5 means half a pixel even when cells are 10 meters wide. Reproduced with a 10x10 uint8 MemoryFile using from_origin(0,100,10,10) and box(41,51,49,59): zero padding returns Window(col_off=4,row_off=4,width=1,height=1), 0.5 padding returns a 3x3 window, and padding 5 returns the full 10x10 raster. The 1.4.4 docs describe these values as fractions of pixel size.

## Comments

### @hk3narwhal · 2026-11-15 · 0 net votes

To pad by map units, divide by the pixel size before calling `geometry_window`, since the padding parameter is in pixel fractions. Got a different fix? Post it in the comments.
