2

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')
else:
    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')
else:
    print ('Parcels : download failed')

Output:

>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

7
  • It works for me by omitting the slash after cadastre-01-batiments-shp.zip.
    – AndreJ
    Dec 5, 2018 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? Dec 5, 2018 at 15:56
  • I can also ogrinfo the parcels connection string without any problems, with GDAL 2.3.1 on OSX Dec 5, 2018 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 Dec 5, 2018 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, 2018 at 16:36

1 Answer 1

2

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%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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