Closed isoneo closed 5 years ago
Hi @isoneo ,
Thanks for trying out rpostgis. We hadn't tested this function on irregular grid resolutions (unequal x/y spacing), as is the case with your example raster. The function ST_SnapToGrid was assuming equal x/y, which was causing the issue. I've patched it in 5b3cec0 and it appears to be working with your test raster.
If you get a chance to test and run into any other issues, that would be great to know. You can install the latest version with:
devtools::install_github("mablab/rpostgis", "dev")
Also, since pgWriteRast
is a pure-R solution, it's not very efficient for large rasters. If you have a lot of large raster to process you'll probably want to use command-line raster2pgsql.
I tried out the dev version and it is working. I will give raster2pgsql a try as well. Thanks
I have been trying to get pgWriteRast to work for some large raster files. Example raster file I'm having issues with https://ufile.io/25trv
I am getting warnings / error "NOTICE: Cannot set value for pixel( x, y) outside raster bounds: X' x Y' ". I dug around a bit and it seems like Line 175 through 180 ST_SnapToGrid is changing the Raster width / height and causing mismatch once you get to Line 189 through 194 where you update pixel values. Could you fix this issue perhaps by adding band within b==1 loop but SnapToGrid after pixel value update?