

def test_raster_transform(self):
    if (GDAL_VERSION < (1, 8, 1)):
        self.skipTest('GDAL >= 1.8.1 is required for this test')
    rstfile = tempfile.NamedTemporaryFile(suffix='.tif')
    ndv = 99
    source = GDALRaster({
        'datatype': 1,
        'driver': 'tif',
        'name': rstfile.name,
        'width': 5,
        'height': 5,
        'nr_of_bands': 1,
        'srid': 4326,
        'origin': ((- 5), 5),
        'scale': (2, (- 2)),
        'skew': (0, 0),
        'bands': [{
            'data': range(25),
            'nodata_value': ndv,
        }],
    })
    target = source.transform(3086)
    target = GDALRaster(target.name)
    self.assertEqual(target.srs.srid, 3086)
    self.assertEqual(target.width, 7)
    self.assertEqual(target.height, 7)
    self.assertEqual(target.bands[0].datatype(), source.bands[0].datatype())
    self.assertEqual(target.origin, [9124842.791079799, 1589911.6476407414])
    self.assertEqual(target.scale, [223824.82664250192, (- 223824.82664250192)])
    self.assertEqual(target.skew, [0, 0])
    result = target.bands[0].data()
    if numpy:
        result = result.flatten().tolist()
    self.assertEqual(result, [ndv, ndv, ndv, ndv, 4, ndv, ndv, ndv, ndv, 2, 3, 9, ndv, ndv, ndv, 1, 2, 8, 13, 19, ndv, 0, 6, 6, 12, 18, 18, 24, ndv, 10, 11, 16, 22, 23, ndv, ndv, ndv, 15, 21, 22, ndv, ndv, ndv, ndv, 20, ndv, ndv, ndv, ndv])

dataset/ETHPy150Open django/django/tests/gis_tests/gdal_tests/test_raster.py GDALRasterTests.test_raster_transform/original