Opened 8 years ago

Closed 5 years ago

#6355 closed enhancement (wontfix)

Allow VSI filesystem access for data files.

Reported by: Kurt Schwehr Owned by: Kurt Schwehr
Priority: normal Milestone: closed_because_of_github_migration
Component: default Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

Another Googler and I are working on a patch to allow GDAL_DATA to be from a VSI filesystem. For example:

CPLPushFinderLocation( "/vsimem/GDAL_DATA/" );

This will make sandboxing GDAL easier and make systems easier where the GDAL_DATA files have to be written to a filesystem somewhere on startup.

This will be changes like VSIFRead -> VSIFReadL for the main gdal code, but we have not figured out how to properly handle the libgeotiff code. We could use some suggestion for libgeotiff.

I will post some of the patches for discussion before committing anything.

Change History (12)

comment:1 by Kurt Schwehr, 8 years ago

In OGRSpatialReference::SetFromUserInput():

--- ogrspatialreference.cpp     (revision 33380)
+++ ogrspatialreference.cpp     (working copy)
@@ -2064,18 +2064,18 @@
 /* -------------------------------------------------------------------- */
 /*      Try to open it as a file.                                       */
 /* -------------------------------------------------------------------- */
-    FILE        *fp;
+    VSILFILE    *fp;
     const size_t nBufMax = 100000;
     char        *pszBufPtr, *pszBuffer;
     size_t      nBytes;
 
-    fp = VSIFOpen( pszDefinition, "rt" );
+    fp = VSIFOpenL( pszDefinition, "rt" );
     if( fp == NULL )
         return OGRERR_CORRUPT_DATA;
 
     pszBuffer = (char *) CPLMalloc(nBufMax);
-    nBytes = VSIFRead( pszBuffer, 1, nBufMax-1, fp );
-    VSIFClose( fp );
+    nBytes = VSIFReadL( pszBuffer, 1, nBufMax-1, fp );
+    VSIFCloseL( fp );
 
     if( nBytes == nBufMax-1 )
     {

comment:2 by Kurt Schwehr, 8 years ago

First patch: r33399 for ogrspatialreference.cpp

comment:3 by Kurt Schwehr, 8 years ago

comment:4 by Kurt Schwehr, 8 years ago

comment:5 by Kurt Schwehr, 8 years ago

comment:6 by Even Rouault, 8 years ago

Resolution: fixed
Status: newclosed

Seems this has been addressed. Closing

comment:7 by Kurt Schwehr, 8 years ago

Resolution: fixed
Status: closedreopened

Not quite there yet. I have a few more changes to come.

comment:8 by Kurt Schwehr, 8 years ago

r33952 for ogr_srs_pci.cpp

comment:9 by Even Rouault, 8 years ago

Removing target milestone as it corresponds to a now closed milestone.

comment:10 by Even Rouault, 8 years ago

Milestone: 2.1.0

comment:11 by Jukka Rahkonen, 6 years ago

Are there still some changes to come?

comment:12 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: reopenedclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.