0

I am trying to write two band TIFF using GDAL/Python. I get empty result although the I see the array should be written in my variables.

    driver = gdal.GetDriverByName("GTiff") # make driver with the geotif format

outdata = driver.Create(outFileName, rows, cols, bands, gdal.GDT_Float32) # parameters: output name, rows, col, bands, data type
outdata.SetGeoTransform(a.GetGeoTransform())##sets same geotransform as input
outdata.SetProjection(a.GetProjection())##sets same projection as input
for i in [0,1]:
    outdata.GetRasterBand(i+1).WriteArray(arr_out[:,:,i])
    outdata.FlushCache() ##saves to disk!!
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.