gipit/gippy

cookie_cutter: xres yres ignored

Opened this issue · 1 comments

Passing xres, yres to cookie_cutter is ignored because here:
https://github.com/gipit/gippy/blob/master/GIP/GeoAlgorithms.cpp#L254
cookie_cutter just grabs the bounding box from the GeoFeature, which is passed down to this code (via GeoImage.create):
https://github.com/gipit/gippy/blob/master/GIP/GeoResource.cpp#L101-L103
and the bounding box is used to compute the resolution being stuffed into the image.

issue demo:

from gippy import GeoVector, GeoImage
from gippy.algorithms import cookie_cutter


v = GeoVector('/home/icooke/merged.shp')
fns = ['/vsizip//tmp/PRISM_ppt_provisional_4kmD2_20190601_bil.zip/PRISM_ppt_provisional_4kmD2_20190601_bil.bil']
imgs = [GeoImage(fn) for fn in fns]
x = cookie_cutter(imgs, 'out.tif', v[0], xres=1000, yres=1000)
print('resolution', x.resolution().x(), x.resolution().y())

# output:
# (venv36) icooke@north:~$ python3 ~/cookie_cutter.py 
# resolution 997.8931017867908 -995.2071382963369

This also seems to move the provided xres and yres to suggestions for approximate resolution:

https://github.com/gipit/gippy/blob/master/GIP/GeoImage.cpp#L318-L320