[gdal-dev] Reading remote jp2k files

Even Rouault even.rouault at spatialys.com
Wed Jul 25 09:00:23 PDT 2018


Matt,

> 
> I'm having trouble reading JP2K files remotely. I originally ran into this
> problem when trying to use remote Sentinel-2 files as input to the GDAL
> Warp API in C++. It works when I use a local version of the file.
> 
> I'm not sure if this is supported behavior, I thought it was, but to test I
> tried gdal_translate on a remote file, and one with the local file.
> 
> $ gdal_translate
> https://sentinel-s2-l1c.s3.amazonaws.com/tiles/32/T/QR/2018/1/21/0/B04.jp2
> sentinel-test-remote.tif -f GTiff
> $ gdal_translate B03.jp2 sentinel-test-local.tif -f GTiff
> 
> The local file works fine, but when using the remote file gdal_translate
> just crashes with no error message.

A process crash ? Can you get a stack trace / valgrind output ?

I tried, and it failed in a regular way, since when you use http:// the HTTP 
driver triggers. This driver downloads the whole file in memory before passing 
it to the real driver, and it deleted the temp file, whereas the JP2OpenJPEG 
driver needs to be able to re-open it. Just fixed that issue

> 
> I'm using GDAL 2.3.1 with openjpeg 2.3, I'm using a docker image
> developmentseed/geolambda:1.0.0 and you can see the Dockerfile here:
> 
> https://github.com/developmentseed/geolambda/blob/master/Dockerfile
> 
> Is this supported behavior, should I be able to read these files remotely,
> and do windowed reads on them?

For windowed reads, you need to prefix with /vsicurl/, but I don't guarantee 
the efficiency of this with JPEG2000 in general, and with JP2OpenJPEG in 
particular.

Even

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


More information about the gdal-dev mailing list