Closed iamtekson closed 6 months ago
I suspect the issue might be due to pixel bleeding a little outside the initial input data bounds.
Potential solution:
width or height = (tile_size * stride_x or stride_y)
k=-1
for j in range(y_gen):
for i in range(x_gen):
k=k+1
z[i*stride_x:(i+1)*stride_x, j*stride_y:(j+1)*stride_y]=tile_dta[k]
// WRITE CODE TO UPDATE **height**, and **width** in **self.meta:**
// **width=new_width, height=new_height**, before using in block below:
with rasterio.open('output.tif', "w", **self.meta) as outds:
outds.write(z.astype('uint8'))
pyplot.imshow(z)
As suspected the issue is due to width and height not updated in the **self.meta before writing. I was able to regenerate the image with above modification. Also the performance was greatly improved by first reconstructing the numpy array from tile (since both doesn't have coordinate, it makes sense as well), then writing it on the file, instead of for
loop in reading and writing operation, which is more resource intensive.
Disc: notice slight padding at the bottom and right after the operation.
For now, I am simply saving all the generated tiles into a new folder and mosaicing it by using gt.mosaic()
function. Yes, you are right, we have some issues in merge_tile
method and I feel like we need to rewrite the function. So, were you able to solve the issue? if yes, please send a PR.
In
merge_tiles
method, the current implementation doesn't merge the tiles and generate the correct merged file. Please rewrite the function to fix this bug.