diff --git a/CHANGELOG.md b/CHANGELOG.md index b9bb90a5b..03cd0728f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +## Version 1.0.4 + +### Bug Fixes +- Fixed an issue where retiling some tile sources could fail (#427) + ## Version 1.0.3 ### Features diff --git a/large_image/tilesource/base.py b/large_image/tilesource/base.py index b862f8a23..e2cc1cdc2 100644 --- a/large_image/tilesource/base.py +++ b/large_image/tilesource/base.py @@ -303,8 +303,8 @@ def setFormat(self, format, resample=False, imageKwargs=None): def _retileTile(self): """ - Given the tile information, create a PIL image and merge multiple tiles - together to form a tile of a different size. + Given the tile information, create a numpy array and merge multiple + tiles together to form a tile of a different size. """ retile = None xmin = int(max(0, self['x'] // self.metadata['tileWidth'])) @@ -316,6 +316,7 @@ def _retileTile(self): tileData = self.source.getTile( x, y, self.level, numpyAllowed='always', sparseFallback=True, frame=self.frame) + tileData, _ = _imageToNumpy(tileData) if retile is None: retile = numpy.zeros( (self.height, self.width) if len(tileData.shape) == 2 else diff --git a/test/test_source_gdal.py b/test/test_source_gdal.py index 27158754a..7c89edfb7 100644 --- a/test/test_source_gdal.py +++ b/test/test_source_gdal.py @@ -324,3 +324,12 @@ def testPalettizedGeotiff(): image = numpy.asarray(image) assert list(image[0, 0, :]) == [0, 0, 0, 0] assert list(image[255, 0, :]) == [221, 201, 201, 255] + + +def testRetileProjection(): + imagePath = utilities.externaldata('data/landcover_sample_1000.tif.sha512') + ts = large_image_source_gdal.GDALFileTileSource(imagePath, projection='EPSG:3857') + ti = ts.getSingleTile(tile_size=dict(width=1000, height=1000), tile_position=1000) + assert ti['tile'].size == 3000000 + tile = ts.getTile(1178, 1507, 12) + assert len(tile) > 1000