1

I am currently investigating if it is possible and practical to obtain JPEG2000 data via HTTP range request, hence in a similar way to cloud optimized geotiff data.

As a test environment I have set up a NGINX server that provides the JP2 data and logs all requests. This way I want to get a better understanding of this topic. Afterwards, I use this python to retrieve a sub-area of the image:

import os
from osgeo import gdal

os.environ["GDAL_DISABLE_READDIR_ON_OPEN"] = "YES" os.environ["CPL_VSIL_CURL_ALLOWED_EXTENSIONS"] = "jp2" os.environ["CPL_VSIL_CURL_CHUNK_SIZE"] = "16384"

download_url = 'http://localhost:8083/T33UWP_20220515T100031_B04_10m.jp2' vsicurl_url = '/vsicurl/' + download_url

output_file = './output/gdal_jp2-http.jp2' gdal.Warp(output_file, vsicurl_url, cutlineDSName = 'aoi.geojson', cropToCutline = True)

I am aware that due to the progressive structure of the data several requests are necessary. However, I can not figure out why 123 requests are necessary.

It seems that GDAL is searching all 121 tiles, do I have to configure GDAL to reduce the amount of requests? I was expecting 6 requests (Head + 5 levels).

I have already tried the JP2ECW-ERDAS driver, same result.

Some more information about the picture:

user04212
  • 11
  • 1
  • 1
    Do you create the JPEG2000 files yourself? For such usage it would probably be better to create the file with just one resolution level. The progression order is certainly also meaningful but I do not know if the GDAL default PRCL is optimal for http access. But JPEG2000 standard was developed for traditional file access and http access was planned to be done via the JPIP protocol. GDAL has a driver for that https://gdal.org/drivers/raster/jpipkak.html but JPIP servers are rare. – user30184 Aug 21 '22 at 20:11
  • I expect that you'll get a better response on the gdal-devs list rather than here – Ian Turton Aug 21 '22 at 20:23
  • Also be aware that JPEG2000 is extremely flexible and all JP2 files are not similar. To start with you can read the usage examples from the Kakadusoftware site https://kakadusoftware.com/wp-content/uploads/Usage_Examples.txt. – user30184 Aug 21 '22 at 20:55

0 Answers0