[gdal-dev] Stacking JP2 files

Even Rouault even.rouault at spatialys.com
Tue Feb 11 13:27:25 PST 2020


On mardi 11 février 2020 18:15:33 CET Júlio César D. M. Esquerdo wrote:
> Hello,
> 
> I'm using gdal_merge.py to stack a set of JP2 rasters with the following
> command line:
> 
> gdal_merge.py *jp2 -o output.jp2 -of JP2OpenJPEG -separate
> 
> It didn't work. I got the message: "Format driver JP2OpenJPEG does not
> support creation and piecewise writing".
> 
> The command works fine for GTiff rasters, but not with JP2 files.
> 
> Is it possible to stack very compressed JP2 files using GDAL?

With gdal_merge.py you can't directly output to JPEG2000 since the output 
format of gdal_merge.py must have random write capabilities, which isn't 
compatible of JPEG2000. A solution would be to output to GeoTIFF and use 
gdal_translate to convert the GeoTIFF to JPEG2000

Or isnstead of gdal_merge, can use gdalbuildvrt -separate to create a VRT 
file, and use gdal_translate to convert it to JPEG2000. That will save you the 
materialization of a GeoTIFF file

In theory it could be possible to stack several JPEG2000 files in a single one 
without any loss, but you'd need to use specialized tools for that.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list