I am trying to create a GeoTIFF raster with GDAL from data stored in numpy matrices. The data is one band, consisting of 0 and 1 values. The zero values are my nodata values. The problem is, the raster it outputs has 255 bands when viewed in ArcGIS. The one band I care about is present and visible, but I'd like to get rid of the other bands, if possible. I think it might have to do with the eType
param for driver.Create()
but I'm not sure.
Here is my Python GDAL code:
raster = driver.Create(rasterPath, results.shape[1], results.shape[0], 1, gdal.GDT_Byte)
raster.SetProjection(projection)
raster.SetGeoTransform(geotransform)
output_band = raster.GetRasterBand(1)
output_band.SetNoDataValue(0)
colors = gdal.ColorTable()
colors.SetColorEntry(1, (255, 0, 0))
output_band.SetRasterColorTable(colors)
output_band.SetRasterColorInterpretation(gdal.GCI_PaletteIndex)
output_band.WriteArray(results)
output_band.FlushCache()
output_band.ComputeStatistics(False)
output_band = None
raster = None
Here is a screenshot of the extra bands I'm talking about in ArcGIS:
The extra, black bands go all the way to 255. Any ideas?