I'm working with mutliple sets of layers in order to create a new one. As I need to load them directly from the internet, I use both /vsizip/ and /vsicurl/

But I'm stuck at loading one of them. Here is what I do:

from osgeo import ogr
address_shp = ogr.Open("/vsizip//vsicurl/http://bano.openstreetmap.fr/BAN_odbl/BAN_odbl_01-shp.zip")
if address_shp is None:
    print ('Address : download successfull')
    print ('Address : download failed')

parcels_shp = ogr.Open("/vsizip//vsicurl/https://cadastre.data.gouv.fr/data/etalab-cadastre/latest/shp/departements/01/cadastre-01-batiments-shp.zip")
if parcels_shp is None:
    print ('Parcels : download successfull')
    print ('Parcels : download failed')


>Address : download successfull
>Parcels : download failed

I got the same result directly in QGis. So, does /vsicurl/ handle https protocol? Or is the problem elsewhere?

OS : Windows 7 / Qgis 2.8.26 & 3.4.2

  • It works for me by omitting the slash after cadastre-01-batiments-shp.zip. – AndreJ Dec 5 '18 at 15:42
  • @AndreJ My bad, it isn't present in my code, I removed it from the question. What are your ogr version and os? – MyComputerIsBurning Dec 5 '18 at 15:56
  • I can also ogrinfo the parcels connection string without any problems, with GDAL 2.3.1 on OSX – Marc Pfister Dec 5 '18 at 16:02
  • So it does work from command line ? It's really strange, I can't open it even with GDAL 2.3.2 using QGis 3.4 – MyComputerIsBurning Dec 5 '18 at 16:11
  • I'm using the same GDAL version on the Windows command line. And Linux Mint 18 with ubuntugis GDAL 2.2.2 and the same result. Since you are on Windows, take a look at osgeo-org.1560.x6.nabble.com/… – AndreJ Dec 5 '18 at 16:36

Thanks @AndreJ for pointing this out.

The problems comes from the fact that curl (which is used by GDAL) may need a certificate for https protocol, depending on how it has been build (specifications here).

Fortunately, one can be downloaded from a secure source, it must be named curl-ca-bundle.crt and dropped in one of the following directories in order to fix the problem (don't forget to close and reload QGis):

  • QGis directory
  • Current working directory
  • Windows System directory (e.g. C:\windows\system32)
  • Windows Directory (e.g. C:\windows)
  • Directory specified in %PATH%
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.