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: