Dear Even,
thank you for the quick response and explanation.
Ok, I think the file was the culprit then. I will try tomorrow with a few
other from the Pleiades PH1A batch to test.
In this case, it was what I wanted to do, because I am warping into
resulting COG in the later step of the processing pipeline, so I wanted to
save the corrected geotransform information in place.

Best,

On Wed, 25 Nov 2020 at 20:45, Even Rouault <[email protected]>
wrote:

> On mercredi 25 novembre 2020 19:53:38 CET Bucek, Lubomir wrote:
> > Dear all,
> > I did not want to file the following question as an issue, as I am not
> sure
> > if I am just not missing anything in configuration, so putting it as a
> > question here:
> >
> > I am trying to change the geotransform of a JPEG2000 file and then save
> > back the content via Python bindings on Ubuntu 20.04 - gdal 3.2.0 (based
> on
> > osgeo/gdal:ubuntu-full-latest -
> > sha256:6a82b53f12945a3ba8ac168a7488d1cf5ecb351020f67c88abc6691275a70b68)
> >
> > Following code:
> > ds = gdal.Open(input_filename, gdal.GA_Update)
> > ulx, xres, xskew, uly, yskew, yres = ds.GetGeoTransform()
> > ... do something with geotransform
> > ds.SetGeoTransform(geotransform_new)
> > del ds
> > Throws me into this exception "USE_SRC_CODESTREAM=YES specified, but no
> > codestream found":
> >
> https://github.com/OSGeo/gdal/blob/master/gdal/frmts/openjpeg/openjpegdatase
> > t.cpp#L3718-L3722
> >
> > How does this creationOption by default being False according to
> > https://gdal.org/drivers/raster/jp2openjpeg.html#creation-options come
> into
> > play while opening and saving an already existing file?
>
> When updating in place a file, USE_SRC_CODESTREAM=YES is set internally at
> https://github.com/OSGeo/gdal/blob/master/gdal/frmts/openjpeg/
> openjpegdataset.cpp#L1457
> to cause the generation of a new file, reusing the code stream, but just
> modifying the other JP2 boxes.
> I'm not sure why this doesn't work for you. Perhaps something with the
> particular image you edit.
>
> But I doubt this is what you want to do anyway. Updating the geotransform
> will
> just change the transform and not change any pixel value.
> So gdal.Warp() is probably more what you want to do indeed.
>
> Even
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>


-- 
*Lubomir Bucek*

Geospatial IT Engineer

EOX IT Services GmbH
1090 Vienna, Thurngasse 8/4, Austria
T +43 (0) 660 369 7514, [email protected] <[email protected]>
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to