-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Hi all!
Either the shift in pixels that I have observed is actually unexpected and needs to somehow be adjusted in the to_coords
function or I'm simply missing something or misunderstanding the concept behind geotransforms and it's only unexpected for me at the moment. Hope someone can help me out either way 🙂
In the following screenshots, the colored image is always the original raster, while the greyscale image is always the one created with these lines of code:
scene_stack = stackstac.stack(items=stac_obj, xy_coords=xy_coords, dtype='float32', rescale=False)
scene_stack.rio.to_raster('./scene_stack.tif')
Transform and projection of the raster: 'proj:transform': [10, 0, 399960, 0, -10, 52000020]
& 'proj:epsg': 32632
(UTM 32N)
-
xy_coords='center'
| pixel shift: 0, 1 (expected: 0.5, -0.5)
-
xy_coords='topleft'
| pixel shift: -0.5, 0.5 (expected: 0, 0)
As expected, no shift is observed in (1). Now with (2) and (3), I'm confused. My original raster is a COG following the usual raster conventions, e.g. being top left aligned. Therefore I'd assume that using the default as in (3) results in no pixel shift at all. I'd also assume that the pixels are shifted by 0.5 and -0.5 in x and y respectively when using 'center' as in (2).
Looking forward to hearing some other thoughts on this!
Cheers, Marco