rasterio.windows.from_bounds height and width int parameters

Paolo Corti

Hi all

I am trying to figure out how to pass the height and width integer
parameters to the from_bounds method. In my case they look not to be
honored and the window returned has slightly different height and
width (which are float).

You can reproduce my issue with this code:

from affine import Affine
from rasterio.coords import BoundingBox
bbox = BoundingBox(left=30.0, bottom=-29.0, right=31.0, top=-28.00083)
transform = Affine(0.0008333333299814356, 0.0, 16.457916616, 0.0, -0.0008333333300030174, -22.127083043)
window = from_bounds(*bounds, src_pop.transform, height=1200, width=1200)
print(window) Window(col_off=16250.500126164021, row_off=7048.496376568462, width=1200.000004826732, height=1199.0040047916773)
Any idea why this is happening? Thanks a lot in advance

Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti