[Gdal-dev] Newbie question about Memory driver

Frank Warmerdam warmerdam at pobox.com
Fri Dec 22 14:48:56 EST 2006


Black, Jerry wrote:
> Hi,
> 
> I'm a newbie, and have a question that stems from my desire to perform 
> the following:
> 
>       gdal_translate from a source data file into a memory driver and then
>       gdal_warp from that memory driver into a 2nd memory driver
> 
> Writing code to essentially call copies of these routines, from my own 
> code works fine when the execution is:
> 
>       gdal_translate from a source data file into a temporary file and then
>       gdal_warp from that file into a 2nd temporary file (at which point
>       my code can grab the raster from the 2nd file)
> 
> 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).
...
> 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?
> 
> I suspect the only solution is to tease out the relevant sections of 
> gdaltranlate and gdalwarp and pass the dataset between them.

Jerry,

You are exactly right.  In order to keep the metadata associated with the
MEM dataset you need to keep it open, and pass the same dataset handle from
step to step.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list