Created
August 28, 2018 18:02
-
-
Save hobu/a794edd3918bcd55e9099f22a8c9bdb2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| options=['COMPRESS=LZW',"BLOCKXSIZE=256", 'TILED=YES', 'COPY_SRC_OVERVIEWS=YES'] | |
| driver = gdal.GetDriverByName('GTiff') | |
| outRaster = driver.Create(filename, cols, rows, 2, gdal.GDT_UInt16 , options=options) | |
| outRaster.SetGeoTransform((originX, pixelWidth, 0, originY, 0, pixelHeight)) | |
| outband = outRaster.GetRasterBand(1) | |
| outband.WriteArray(array) | |
| zband = outRaster.GetRasterBand(2) | |
| zs = np.empty_like(array) | |
| zs.fill(z) | |
| zband.WriteArray(zs) | |
| outRaster.BuildOverviews( 'nearest', overviewlist = [1, 2, 4]) | |
| zband.FlushCache() | |
| outband.FlushCache() | |
| outRaster.FlushCache() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment