[gdal-dev] unable to create jpeg200 files with self compiled gdal and openjpeg

Andre Hollstein andre.hollstein at gfz-potsdam.de
Tue Jul 12 01:12:22 PDT 2016


Dear gdal experts,

I'm compiling gdal and a whole list of other libraries myself. Currently 
I'm using gdal-2.1.0 and openjepeg v2.1.1 and use the libs from python:

import gdal
import numpy as np
gdal.AllRegister()
#driver = 'JP2KAK'
driver = "JP2OpenJPEG"
#driver = "GTiff"
#driver = "JPEG2000" # jasper

fn = "./img_buf.%s" % 
{"GTiff":"tiff",'JP2KAK':"jp2","JP2OpenJPEG":"jp2","JPEG2000":"jp2"}[driver]

sh = (1000,1000)
img = np.ones(sh,dtype=np.int16)
dr = gdal.GetDriverByName(driver)
ds = dr.Create(fn,img.shape[0],img.shape[1],1,gdal.GDT_UInt16) # here I 
get: ERROR 6: GDALDriver::Create() ... no create method implemented for 
this format.
if ds is None: raise ValueError(fn)
rb = ds.GetRasterBand(1)
rb.WriteArray(img)
ds.FlushCache()
ds = None

This code works for geotiff, but not for jpeg2000. There I'm getting the 
error: ERROR 6: GDALDriver::Create() ... no create method implemented 
for this format.

I tested various combinations of various data types without any change 
in behavior.

I guess it should work, what can I do to solve this issue?

I compile openjpeg like this:

cmake . -DCMAKE_INSTALL_PREFIX=$prefix_opt -DCMAKE_C_FLAGS="-O3 -fPIC" 
-DBUILD_SHARED_LIBS:bool=on -DBUILD_CODEC:bool=on

and gdal like that:

kdu_opts=--with-kakadu=$prefix_opt
conda install --yes numpy
./configure \
--prefix $prefix_opt \
--with-openjpeg=$prefix_opt \
--with-jasper=$prefix_opt \
--with-libtiff=$prefix_opt \
--without-libtool \
--with-hdf4=$prefix_opt \
--with-hdf5=no \
--with-netcdf=no \
--with-geotiff=internal \
--with-grass=no \
--with-sqlite3=no \
$kdu_opts \
--with-pic \
--with-python=$prefix_python/bin/python \

make install
make clean

Am I missing any needed flags or options?

Kind regards, André

-- 
Dr. André Hollstein
Sektion 1.4 Fernerkundung
Tel.: +49 (0)331/288-28969
Fax: +49 (0)331/288-28969
E-Mail: andre.hollstein at gfz-potsdam.de
___________________________________

Helmholtz-Zentrum Potsdam
Deutsches GeoForschungsZentrum GFZ
Stiftung des öff. Rechts Land Brandenburg
Telegrafenberg, 14473 Potsdam
Haus 17, Raum 20.23



More information about the gdal-dev mailing list