[gdal-dev] ftp user and password with vsizip/vsicurl

Even Rouault even.rouault at mines-paris.org
Tue Apr 12 14:11:20 EDT 2011


Le mardi 12 avril 2011 17:26:02, Eli Adam a écrit :
> Is it possible to use vsizip and vsicurl on a password protected ftp site?
> 
> Something like this command with user and password passed somehow:
> 
> ogrinfo -ro -al -so
> /vsizip/vsicurl/ftp://example.com/foldername/file.zip/example.shp
> 
> I rather hopefully tried some switches, -user:user -password:password,
> which did not work.

I've just tried with an FTP site and ogrinfo -ro -al -so 
/vsizip/vsicurl/ftp://user:password@example.com/foldername/file.zip/example.shp 
works

> 
> Thanks for the vsi support, it is awesome!  For vsizip/gz/tar, I find this
> wiki page very useful, http://trac.osgeo.org/gdal/wiki/UserDocs/ReadInZip 
> I can find all the gdal drivers that support virtual files by following
> the directions on that page (driver marked with 'v' when running 'gdalinfo
> --formats').  I tried a similar approach for ogr (ogrinfo --formats and
> looked for 'v') without learning much.  Is there a way to determine
> virtual file support in ogr?  I found that shp is supported by
> successfully testing it and recalling an IRC mention.

No, there's no easy way of knowing if an OGR driver supports VSI virtual file 
handlers such as vsizip, vsicurl etc...

From a quick "grep -r VSILFILE ogr/ogrsf_frmts/", I can see in current trunk 
(might not be the case for all drivers in GDAL 1.8.0 as a few have been 
converted since the release), that CSV, PGDUMP (well, this is just write-
only),  SVG, KML, HTF, DXF, PDS, VRT, GPX, AERONAVFAA, GTM, EDIGEO, SHAPE, 
OPENAIR, LIBKML, GEORSS, GPSBABEL, BNA, GEOJSON, XPLANE, GMT, GML, SUA and S57 
use the VSI virtual file API at least partially. Caution : It doesn't mean that 
they are all fully vetted to be compatible with it.

> 
> Most of what I find for vsicurl is here,
> http://trac.osgeo.org/gdal/wiki/Release/1.8.0-News  Is there somewhere
> else that I should look for documentation on vsicurl?  I gave a shot at
> adding information to the vsizip wiki page, can someone review it to make
> sure that I am not spreading false information and correct or delete it if
> needed?  I added to the vsizip page rather than making a different page
> since vsicurl is often used with vsizip. 

There's some info in the doc of VSIInstallCurlFileHandler() here 
http://gdal.org/cpl__vsi_8h.html#4f791960f2d86713d16e99e9c0c36258

You might want to add the link to it, like it is done for the other special 
file handlers in the page.

> Currently, the example commands
> that I put there give an error claiming that the .shx is corrupt.  For
> instance, ogrinfo -ro -al -so
> /vsicurl/http://trac.osgeo.org/gdal/browser/trunk/autotest/ogr/data/poly.s
> hp

This was just a bad URL. ogrinfo -ro -al -so 
/vsicurl/http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.shp works

> 
> 
> Any help appreciated, Eli
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list