[gdal-dev] Fwd: How to reuse memory pointer of GDAL Memory driver
Pol Monsó PurtÃ
lluna.nova at gmail.com
Fri Jun 3 11:45:10 PDT 2016
I've posted this question on gis stackexchange, but maybe here is more
appropriate.
I am doing the same as in
http://gis.stackexchange.com/questions/134000/gdal-api-cant-save-image-in-some-formats
That is, saving a `JPEG` image with `GDAL`. I know I'd have to create a
`MEM` buffer and then `CreateCopy` to `JPEG`. However, I'd like to avoid
the allocation of two buffers since my image might be big and I use my own
memory buffer.
Is there a way to pass the data memory address that I'd like to use to the
MEM driver?
I've seen this mysterious article http://www.gdal.org/frmt_mem.html which
references the `DATAPOINTER` option. I've seen another reference [here](
https://lists.osgeo.org/pipermail/gdal-dev/2006-November/010583.html)
which does
sprintf(filename,"MEM:::DATAPOINTER=%d,PIXELS=%d,LINES=%d,BANDS=1,DATATYPE=%d,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=0",datpt,pixels,lines,datatype);
dataset = GDALOpen(filename,GA_Update);
How would this translate to c++? Maybe
papszOptions = CSLSetNameValue( papszOptions, "DATAPOINTER",
datapointer );
and so on?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160603/53e533a1/attachment-0001.html>
More information about the gdal-dev
mailing list