<div dir="ltr"><div><div><div><div>I turned
 on some debug options that shed some light on to what's going on. It 
appears that the NITF driver must internally open a JPEG 2000 Driver on a
 virtual subfile. In my case, that virtual subfile starts at offset 4038
 and continues to the end of the file, offset 901949970. <br></div><br></div>While
 this is a nice way of providing a JPEG2000 decompression routine to the
 NITF driver, when accessing a remote dataset, it causes the entire file
 to be downloaded even when reading a small window. <br><br></div>I used
 gdal_translate locally on my NITF file and turned it into a JP2 file, 
then I uploaded this file to S3 and ran my gdal_translate -srcwin 000 
000 1000 1000 /vsis3/mybucket/jp2file.JP2 local_file.tiff and it ran 
instantly. Is there a way to completely bypass using the NITF driver and
 simply open the NITF file with the JP2 driver wrapped up with vsis3?<br><br></div>Thank you very much for your time. Also thank you for writing the vsicurl and vsis3 code -- it's been very useful!</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 24, 2017 at 10:41 AM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div style="font-family:'Sans Serif';font-size:9pt;font-weight:400;font-style:normal"><div><div class="h5">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">On dimanche 23 juillet 2017 23:09:05 CEST you wrote:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Hi Even,</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> I posted in the gdal-dev mailing list about reading sub-windows out of NITF</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> files in S3. I turned on some debug options that shed some light on to</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> what's going on. It appears that the NITF driver must internally open a</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> JPEG 2000 Driver on a virtual subfile. In my case, that virtual subfile</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> starts at offset 4038 and continues to the end of the file, offset</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> 901949970.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> While this is a nice way of providing a JPEG2000 decompression routine to</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> the NITF driver, when accessing a remote dataset, it causes the entire file</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> to be downloaded even when reading a small window.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> I used gdal_translate locally on my NITF file and turned it into a JP2</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> file, then I uploaded this file to S3 and ran my gdal_translate -srcwin 000</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> 000 1000 1000 /vsis3/mybucket/jp2file.JP2 local_file.tiff and it ran</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> instantly. Is there a way to completely bypass using the NITF driver and</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> simply open the NITF file with the JP2 driver wrapped up with vsis3?</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Thank you very much for your time. Also thank you for writing the vsicurl</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> and vsis3 code -- it's been very useful!</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</div></div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Do you mind reposting your above findings to the gdal-dev thread so we can continue the exchange there ?</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Even</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">-- </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Spatialys - Geospatial professional services</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a></p></div></blockquote></div><br></div>