MRF: Allow open of MRF-in-TAR as MRF #10331
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Allow the use of a tar file containing a single MRF directly as an MRF.
It has always been possible to open an MRF (as any other gdal format) inside a tar file by using a vsitar path.
This change allows a tar file that starts with the MRF metadata file to be directly recognized and opened for reading without having to use the vsitar path. This makes an MRF inside a TAR file act as a single file raster format, making it easier to share. All the MRF files have to be inside the tar, with the main metadata (.mrf) being the first.
The identification of such an MRF-in-TAR candidate is done by directly inspecting the tar header and the beginning of the first file inside the tar, without invoking using /vsitar.
This change does not interfere with the use of any other file inside the tar using the normal /vsitar path. The only difference is that gdalinfo on such a mrf-in-tar file will return the MRF information, as opposed to listing the tar content as it does now.
The last file extension has to be .tar to be correctly opened by vsitar internally, the recommended file name for an MRF-in-TAR will be filename.mrf.tar