Image::GeoTIFF::Tiled::Iterator - A convenience class to iterate through arbitrarily-shaped raster data.
use Image::GeoTIFF::Tiled; my $tiff = Image::GeoTIFF::Tiled->new( $tiff_filepath ); my $iter = $tiff->get_iterator_pix( $px_min, $py_min, $px_max, $py_max ); # Dump the buffered contents $iter->dump_buffer; while ( defined( my $val = $iter->next ) ) { printf "(%.3f,%.3f): %i\n", $tiff->pix2proj(@{$iter->current_coord}), $val; ... # do something based on the location, value }
A convenience class to iterate through arbitrarily-shaped raster data. Returns some useful state information although there's room for additional features.
Where %opts must have the keys boundary and buffer, and optionally mask.
The boundary of the buffer.
Returns the data buffer (a 2D array).
Returns the buffer mask (a 2D array) or undef if one wasn't provided.
Returns the value at row $row, column $col.
The number of rows in the buffer.
The number of columns in the buffer.
The current row corresponding to the last value passed by next.
next
The current column corresponding to the last value passed by next.
Returns the (x,y) pixel coordinate corresponding to the last value returned by next as a list. The coordinate is placed in the middle of the pixel.
Returns the next buffer value, or undef if there are no further values.
Resets the iterator so the next() returns the first value.
Returns the 8 adjacent values to the current coordinate as a list, starting from the northwest and going clockwise.
Pretty prints the buffer's values.
Copyright 2010 Blake Willmarth.
This program is free software; you can redistribute it and/or modify it under the terms of either:
the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or
the Artistic License version 2.0.
To install Image::GeoTIFF::Tiled, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::GeoTIFF::Tiled
CPAN shell
perl -MCPAN -e shell install Image::GeoTIFF::Tiled
For more information on module installation, please visit the detailed CPAN module installation guide.