<div dir="ltr"><div><div><div>Just one more question,<br><br></div>If i set the option BAND=0, what should the DATAPOINTER be? Does it become optional?<br><br></div>Cheers<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 6, 2016 at 10:55 AM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Monday 06 June 2016 10:45:47 Pol Monsó Purtí wrote:<br>
> THanks Mateusz,<br>
><br>
> You're right. I'm trying it as we speak.<br>
><br>
> In my case I have a std::vector<GByte*> of the 3 bands, where the GByte*<br>
> are allocated in the heap with new GByte[width*height]. I guess that won't<br>
> work because the three bands have to be one single memory chunk, am I<br>
> right? I guess the only solution is to switch to single band float and<br>
> merge rgb to float. I'd prefer not having to refactor the rest of the code.<br>
<br>
<br>
> Is it possible to have a different address for each band?<br>
<br>
</span>Yes, create a dataset with 0 band and then add each band with the<br>
GDALDataset::AddBand() method<br>
<br>
See <a href="http://gdal.org/frmt_mem.html" rel="noreferrer" target="_blank">http://gdal.org/frmt_mem.html</a> :<br>
"""The MEM format is one of the few that supports the AddBand() method. The<br>
AddBand() method supports DATAPOINTER, PIXELOFFSET and LINEOFFSET options to<br>
reference an existing memory array."""<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> All this is to support jpg as output. All the operations are done in my<br>
> GByte array and it's only at the end that I create the dataset and image.<br>
> At the moment I create a Tiff and finally createcopy to jpg.<br>
><br>
> On Fri, Jun 3, 2016 at 9:10 PM, Mateusz Loskot <<a href="mailto:mateusz@loskot.net">mateusz@loskot.net</a>> wrote:<br>
> > On 3 June 2016 at 20:45, Pol Monsó Purtí <<a href="mailto:lluna.nova@gmail.com">lluna.nova@gmail.com</a>> wrote:<br>
> > > I've seen this mysterious article <a href="http://www.gdal.org/frmt_mem.html" rel="noreferrer" target="_blank">http://www.gdal.org/frmt_mem.html</a><br>
> ><br>
> > which<br>
> ><br>
> > > references the `DATAPOINTER` option. I've seen another reference<br>
> > > [here](<br>
> ><br>
> > <a href="https://lists.osgeo.org/pipermail/gdal-dev/2006-November/010583.html" rel="noreferrer" target="_blank">https://lists.osgeo.org/pipermail/gdal-dev/2006-November/010583.html</a>)<br>
> ><br>
> > > which does<br>
> ><br>
> > sprintf(filename,"MEM:::DATAPOINTER=%d,PIXELS=%d,LINES=%d,BANDS=1,DATATYPE<br>
> ><br>
=%d,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=0",datpt,pixels,lines,datatype);><br>
> > > dataset = GDALOpen(filename,GA_Update);<br>
> > ><br>
> > > How would this translate to c++?<br>
> ><br>
> > The line above is valid C++, isn't it.<br>
> > If you followed to Frank's answer [1], you'd see it slightly corrected<br>
> > but the technique remains the same.<br>
> ><br>
> > [1] <a href="https://lists.osgeo.org/pipermail/gdal-dev/2006-November/010603.html" rel="noreferrer" target="_blank">https://lists.osgeo.org/pipermail/gdal-dev/2006-November/010603.html</a><br>
> ><br>
> > Best regards,<br>
> > --<br>
> > Mateusz Loskot, <a href="http://mateusz.loskot.net" rel="noreferrer" target="_blank">http://mateusz.loskot.net</a><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</font></span></blockquote></div><br></div>