[Gdal-dev] How can I initialize the GDALDataset structures without calling GDALOpen

Frank Warmerdam warmerdam at pobox.com
Wed Mar 24 14:06:07 EST 2004


Joaquim Luis wrote:
> Hi,
> I hope this not a very idiot question.
> I want to write Matlab mex files that mimic the functionality of gdal_translate
> and gdalwarp. The problem is that I already have the image data (and the
> corresponding
> info) in memory, and they where not obtained by a call to GDALOpen. As such, the
> GDALDataset structures were not initialized and the rest of the code won't work.
> My question is, how can I handle this situation?
> Has someone solved this before? That is, is there any code that I can use as an
> example?

Joachim,

I'm not exactly clear on what you are doing.  Are you wanting to do a memory
to memory warp?  A memory to disk write?

I think you should read over the information about the "In Memory" format.
This is a GDAL driver that allows you to describe an array in memory as a
GDAL dataset.  This is often used as a pre-step to using GDALCreateCopy()
to create a copy of the image on disk.

   http://www.remotesensing.org/gdal/frmt_mem.html

Basically, you will constuct an esoteric string "dataset name" describing
the memory array, and then call GDALOpen() on that to create a dataset handle
for a memory array.  Then you can attach metadata, georeferencing and so on
normally and use the dataset handle with other GDAL functions like the warper
or GDALCreateCopy().

Once you have made an effort at this feel free to ask for more detail on parts
that are giving you problems ... but some more specific context would be helpful.

Good luck,

-- 
---------------------------------------+--------------------------------------
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    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list