<div dir="ltr">Hi, <br>Thanks for your quick reply.<br>When I edit my code function to be:<br>def WriteRaster (dst_filename, raster):<br> <br> format = "AAIGrid"<br> driver = gdal.GetDriverByName( format )<br>
dst_ds = driver.Create( dst_filename, 71, 73,\<br> 1,gdal.GDT_Float32,options=["COMPRESS=PACKBITS","TFW=YES"] )<br><br>Python complains:<br><br>ERROR 6: GDALDriver::Create() ... no create method implemented for this format.<br>
<br>alsp<br>>This file must be the .tfw, right? I expect you created a geotiff file as<br>>well which is where your data is.<br><br>True, a file with the suffix I choose. This file is binary and I can't see it. <br>
<br>So I would rather use the code supplied to save as text. This however is still not successful, <br>Thanks, <br>Oz. <br><br><div class="gmail_quote">On Thu, Mar 5, 2009 at 9:28 PM, Bryan Keith <span dir="ltr"><<a href="mailto:bryan@ideotrope.org">bryan@ideotrope.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> Hello Again,<br>
<div class="im">> def WriteRaster (dst_filename, raster):<br>
><br>
> format = "GTiff"<br>
<br>
</div>Oz,<br>
<br>
You're creating a geotiff. Try:<br>
<br>
format = "AAIGrid"<br>
<div class="im"><br>
> driver = gdal.GetDriverByName( format )<br>
> dst_ds = driver.Create( dst_filename, 71, 73,\<br>
> 1,gdal.GDT_Float32,options=["COMPRESS=PACKBITS","TFW=YES"]<br>
> )<br>
<br>
</div>These options won't be available for "AAIGrid".<br>
<div class="im"><br>
> dst_ds.SetGeoTransform( [-19.5, 1.0, 0.0, 37.5, 0.0, -1.0] )<br>
> srs = osr.SpatialReference()<br>
> srs.ImportFromEPSG(4326) #WGS84 lat long.<br>
> dst_ds.SetProjection( srs.ExportToWkt() )<br>
> dst_ds.GetRasterBand(1).WriteArray( raster )<br>
> dst_ds = None<br>
><br>
><br>
> c= a+b<br>
> print c<br>
> WriteRaster ('raster3.gtiff', c)<br>
><br>
> A file with following content is created:<br>
><br>
> 1.0000000000<br>
> 0.0000000000<br>
> 0.0000000000<br>
> -1.0000000000<br>
> -19.0000000000<br>
> 37.0000000000<br>
<br>
</div>This file must be the .tfw, right? I expect you created a geotiff file as<br>
well which is where your data is.<br>
<font color="#888888"><br>
Bryan<br>
<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br><br>----<br> Imagine there's no countries<br> It isn't hard to do<br> Nothing to kill or die for<br> And no religion too<br>
Imagine all the people<br> Living life in peace <br>----<br> You all must read 'The God Delusion' <br> <a href="http://en.wikipedia.org/wiki/The_God_Delusion">http://en.wikipedia.org/wiki/The_God_Delusion</a><br>
---<br>when one person suffers from a delusion it is called insanity. When many people suffer from a delusion it is called religion."<br>Robert Pirsig, Zen and the Art of Motorcycle Maintenance<br><br>
</div>