[gdal-dev] GDAL /vsistdin/ 1MB limit

Even Rouault even.rouault at spatialys.com
Tue May 4 02:25:58 PDT 2021

/vsistdin/ is only meant for format whose reading is compatible of a 
streamed reading, that is you read bytes as they come from stdin. Which 
is only a subset of formats, and PDF is not in that subset (typically 
the cross reference table to objects is always put at the end of the 
file, hence the Seek(SEEK_END error you get). The 1 MB limit corresponds 
to the amount of data that is cached at the beginning of the file (this 
helps for drivers that do almost streamed reading, but do some backward 
seeks in their header part). Beyond that, /vsimem/ doesn't buffer 
anything, so if the driver  tries to seek back, that  fails. This 1MB 
limit could potentially be changed to be runtime configured, but that's 
not the case currently.

Le 04/05/2021 à 07:04, Romeo Alvaraz a écrit :
> Hi there,
> I've got a PDF geo-referencing implementation in place which makes use of
> the gdal_translate utility.  Recently I've been testing out and
> implementation to read in the input content from standard input stream using
> the  /vsistdin/ handler.
> According to the documentation for /vsistdin/ handler -  "Full seek in the
> first MB of a file is possible" and I've encountered the following error(s)
> when the content I've attempted to pipe in is greater than 1MB.
> ERROR 6: Seek(SEEK_END) unsupported on /vsistdin when stdin > 1 MB
> ERROR 6: backward Seek() unsupported on /vsistdin above first MB
> Would this be a hard limit of 1MB placed the content size which can be piped
> in via /vsistdin/(the source code and the error message suggests it migh me)
> or  can it be configured? Has anyone encountered this before?
> Any suggestions will be appreciated
> Thanks.
> Platform: Windows 64-bit
> Version: GDAL 2.4.4, released 2020/01/08 sourced from
> https://www.gisinternals.com/release.php
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

My software is free, but my time generally not.

More information about the gdal-dev mailing list