<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 6/27/2014 9:26 PM, devendra dahal wrote:
<blockquote type="cite">
<div dir="ltr">
<div>
<div>file1 = "my_raster.tif"<br>
</div>
<div>OutFile = "wetlands.tif"<br>
</div>
<div>rastDriver = gdal.GetDriverByName('Gtiff') # reading gdal
driver </div>
<div>rastDriver.Register() <br>
</div>
</div>
</div>
</blockquote>
look at <a
href="http://gis.stackexchange.com/questions/69138/polygonize-py-attributeerror-nonetype-object-has-no-attribute-createdatasou">this
StackExchange topi</a>c. I think your problem is you have the
wrong driver name. It's GTiff (note the capital T). <br>
I'm a little surprised the Register didn't fail, but that's life. <br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div><bunch of stuff deleted><br>
</div>
</div>
</blockquote>
<br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>dst_ds = rastDriver.Create(OutFile, cols, rows, bands,
GDT_Int16)<span class="" style="white-space:pre"> </span></div>
<div>dst_ds.SetGeoTransform(geot)</div>
<div>dst_ds.SetProjection(proj)</div>
<div>dst_ds.GetRasterBand(1).WriteArray(newArray)<br>
</div>
</div>
<div>newArray = None<br>
</div>
</div>
</blockquote>
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.<br>
<blockquote type="cite">
<div dir="ltr"><more stuff deleted><br>
</div>
</blockquote>
<br>
<blockquote type="cite">
<div dir="ltr">
<div>But it throws the error below.</div>
<div><br>
</div>
<div>
<div>dst_ds = drv.CreateDataSource( dst_filename )</div>
<div>AttributeError: 'NoneType' object has no attribute
'CreateDataSource'</div>
</div>
</div>
</blockquote>
<div dir="ltr">
<div>You cut out the traceback that would have helped spot or at
least localize the error. <br>
<br>
David Strip<br>
</div>
</div>
</body>
</html>