On 6/27/2014 9:26 PM, devendra dahal wrote:
file1 = "my_raster.tif"
OutFile = "wetlands.tif"
rastDriver = gdal.GetDriverByName('Gtiff') # reading gdal driver 
rastDriver.Register()
look at this StackExchange topic. I think your problem is you have the wrong driver name. It's GTiff (note the capital T).
I'm a little surprised the Register didn't fail, but that's life.

<bunch of stuff deleted>

dst_ds = rastDriver.Create(OutFile, cols, rows, bands, GDT_Int16)
dst_ds.SetGeoTransform(geot)
dst_ds.SetProjection(proj)
dst_ds.GetRasterBand(1).WriteArray(newArray)
newArray = None
I can't see anyplace where geot and proj are assigned values. This will probably be your next problem when you get past the error you're seeing.
<more stuff deleted>

But it throws the error below.

dst_ds = drv.CreateDataSource( dst_filename )
AttributeError: 'NoneType' object has no attribute 'CreateDataSource'
You cut out the traceback that would have helped spot or at least localize the error.

David Strip
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to