Le mardi 20 septembre 2016 17:13:44, Andrew Bell a écrit :
> On Sun, Sep 18, 2016 at 5:49 AM, Even Rouault <even.roua...@spatialys.com>
> 
> wrote:
> > Le dimanche 18 septembre 2016 11:02:20, Sean Gillies a écrit :
> > > Hi Andrew, Even,
> > > 
> > > I am so grateful you asked this question, Andrew.
> > 
> > UPDATE: Andrew, after digging, I believe you have hit
> > https://trac.osgeo.org/gdal/ticket/6592 whose fix hasn't yet reached any
> > released version.
> 
> Thanks Even,
> 
> It seems like doing something else to set the metadata change flag will
> make things work.  Unfortunately, the change flag seems to be guarded so
> one has to make an actual change to get it to be set.  Something like the
> following works, but is a little crufty and deserves a comment.  Perhaps
> there's a better way?
> 
> int nBands = 5;
> dataset->Create(filename, width, height, nBands, ...);
> 
> for (int i = 1; i <= nBands; ++i)
> {
>     GDALRasterBand *band = dataset->GetRasterBand(i);
>     band->SetDescription(someString);
> 
>     // Force metadata change flag so that description gets written.
> Current bug
>     // (ticket 6592) requires something like this.
>     band->SetOffset(band->GetOffset(NULL) + .00001);
>     band->SetOffset(band->GetOffset(NULL) - .00001);

Or  just
band->SetOffset(1)
band->SetOffset(0)

since 0 is the default offset (and if you don't customize it).

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to