From c78d4d59770b84197f237494c82cab36ebb97b84 Mon Sep 17 00:00:00 2001 From: Caiubi Oliveira Fonseca Date: Mon, 18 Nov 2024 17:51:34 -0300 Subject: [PATCH] fix: prevents read_lines_by_block from skipping pixels See issue #4 --- lib/gdal/extensions/raster_band/io_extensions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gdal/extensions/raster_band/io_extensions.rb b/lib/gdal/extensions/raster_band/io_extensions.rb index f434ad31..f2a269fe 100644 --- a/lib/gdal/extensions/raster_band/io_extensions.rb +++ b/lib/gdal/extensions/raster_band/io_extensions.rb @@ -110,8 +110,8 @@ def read_lines_by_block return enum_for(:read_lines_by_block) unless block_given? read_blocks_by_block do |pixels, x_block_size, y_block_size| - pixels.each_slice(x_block_size).with_index do |row, block_row_number| - yield row + pixels.each_slice(block_size[:x]).with_index do |row, block_row_number| + yield row.take(x_block_size) break if block_row_number == y_block_size - 1 end end