Opened 4 years ago

Closed 16 months 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 Changed 4 years ago by Kurt Schwehr

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 Changed 4 years ago by Kurt Schwehr

First patch: r33399 for ogrspatialreference.cpp

comment:3 Changed 4 years ago by Kurt Schwehr

comment:4 Changed 4 years ago by Kurt Schwehr

comment:5 Changed 4 years ago by Kurt Schwehr

comment:6 Changed 4 years ago by Even Rouault

Resolution: fixed
Status: newclosed

Seems this has been addressed. Closing

comment:7 Changed 4 years ago by Kurt Schwehr

Resolution: fixed
Status: closedreopened

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

comment:8 Changed 4 years ago by Kurt Schwehr

r33952 for ogr_srs_pci.cpp

comment:9 Changed 4 years ago by Even Rouault

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

comment:10 Changed 4 years ago by Even Rouault

Milestone: 2.1.0

comment:11 Changed 3 years ago by Jukka Rahkonen

Are there still some changes to come?

comment:12 Changed 16 months ago by Even Rouault

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.