<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.34">
<TITLE>Newbie question about Memory driver</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2 FACE="Arial">Hi,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I'm a newbie, and have a question that stems from my desire to perform the following:</FONT>
</P>
<UL>
<P><FONT SIZE=2 FACE="Arial">gdal_translate from a source data file into a memory driver and then</FONT>
<BR><FONT SIZE=2 FACE="Arial">gdal_warp from that memory driver into a 2nd memory driver </FONT>
</P>
</UL>
<P><FONT SIZE=2 FACE="Arial">Writing code to essentially call copies of these routines, from my own code works fine when the execution is:</FONT>
</P>
<UL>
<P><FONT SIZE=2 FACE="Arial">gdal_translate from a source data file into a temporary file and then</FONT>
<BR><FONT SIZE=2 FACE="Arial">gdal_warp from that file into a 2nd temporary file (at which point my code can grab the raster from the 2nd file)</FONT>
</P>
</UL>
<P><FONT SIZE=2 FACE="Arial">When attempting to use memory drivers, the gdal_warp code quite validly complains that there is not affine transformation (note this being done in C++ so the memory address is valid between these calls).</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">Translating file:</FONT>
<BR><FONT SIZE=2 FACE="Courier New">gdal_translate -of MEM -co PHOTOMETRIC=RGB -co INTERLEAVE=PIXEL -ot Byte -outsize 1226 574 -projwin -130.000000 52.000000 -113.883258 47.000000</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">c:/world-topo-bathy-200406-3x86400x43200.ecw</FONT>
<BR><FONT SIZE=2 FACE="Courier New">MEM:::DATAPOINTER=142409800,PIXELS=613,LINES=287,BANDS=3,DATATYPE=Byte</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Input file size is 86400, 43200</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">Warping file:</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Gdalwarp -s_srs EPSG:4326 -t_srs +proj=merc +lon_0=-121.942w -ts 613 287 -wt Byte</FONT>
<BR><FONT SIZE=2 FACE="Courier New">MEM:::DATAPOINTER=142409800,PIXELS=613,LINES=287,BANDS=3,DATATYPE=Byte</FONT>
<BR><FONT SIZE=2 FACE="Courier New">c:/world-topo-bathy-200406-3x86400x43200_MERC.TIF</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">Unable to compute a transformation between pixel/line</FONT>
<BR><FONT SIZE=2 FACE="Courier New">and georeferenced coordinates for MEM:::DATAPOINTER=142409800,PIXELS=613,LINES=287,BANDS=3,DATATYPE=Byte.</FONT>
<BR><FONT SIZE=2 FACE="Courier New">There is no affine transformation and no GCPs.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">As the Memory driver only stores the actual pixels, I can see why the affine transformation is missing when calling gdalwarp. Either I'm missing a parameter for gdalwarp that would enable this, or is there another memory driver example / or approach available that encapsulates all of the projection info into the memory structure?</FONT></P>

<P><FONT SIZE=2 FACE="Arial">I suspect the only solution is to tease out the relevant sections of gdaltranlate and gdalwarp and pass the dataset between them.</FONT></P>
<BR>

<P><FONT SIZE=2 FACE="Arial">The original ecw file has EPSG:4326 imbedded in it.</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">gdalinfo</FONT>
<BR><FONT SIZE=2 FACE="Courier New">c:/world-topo-bathy-200406-3x86400x43200.ecw</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Driver: ECW/ERMapper Compressed Wavelets</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Size is 86400, 43200</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Coordinate System is:</FONT>
<BR><FONT SIZE=2 FACE="Courier New">GEOGCS[&quot;WGS 84&quot;,</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp; DATUM[&quot;WGS_1984&quot;,</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SPHEROID[&quot;WGS 84&quot;,6378137,298.257223563,</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TOWGS84[0,0,0,0,0,0,0],</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp; PRIMEM[&quot;Greenwich&quot;,0,</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp; UNIT[&quot;degree&quot;,0.0174532925199433,</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AUTHORITY[&quot;EPSG&quot;,&quot;9108&quot;]],</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp; AXIS[&quot;Lat&quot;,NORTH],</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp; AXIS[&quot;Long&quot;,EAST],</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp; AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Origin = (-180.000000,90.000000)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Pixel Size = (0.00416667,-0.00416667)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Corner Coordinates:</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Upper Left&nbsp; (-180.0000000,&nbsp; 90.0000000) (180d 0'0.00&quot;W, 90d 0'0.00&quot;N)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Lower Left&nbsp; (-180.0000000, -90.0000000) (180d 0'0.00&quot;W, 90d 0'0.00&quot;S)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Upper Right ( 180.0000000,&nbsp; 90.0000000) (180d 0'0.00&quot;E, 90d 0'0.00&quot;N)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Lower Right ( 180.0000000, -90.0000000) (180d 0'0.00&quot;E, 90d 0'0.00&quot;S)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Center&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (&nbsp; -0.0000000,&nbsp;&nbsp; 0.0000000) (&nbsp; 0d 0'0.00&quot;W,&nbsp; 0d 0'0.00&quot;N)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Band 1 Block=86400x1 Type=Byte, ColorInterp=Red</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp; Overviews: arbitrary</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Band 2 Block=86400x1 Type=Byte, ColorInterp=Green</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp; Overviews: arbitrary</FONT>
<BR><FONT SIZE=2 FACE="Courier New">Band 3 Block=86400x1 Type=Byte, ColorInterp=Blue</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp; Overviews: arbitrary</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Thanks</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Jerry Black&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=2 FACE="Arial">Bedford Institute of Oceanography </FONT>
</P>

</BODY>
</HTML>