Skip to content
Permalink
Browse files

Correct autodetection of vsizip based shapefiles depends on GDAL 3.1

  • Loading branch information
nyalldawson committed Feb 12, 2020
1 parent 54eba4a commit 50bdd361886eb66dcf732cfa187eb1139e9362f0
Showing with 8 additions and 5 deletions.
  1. +8 −5 tests/src/python/test_provider_shapefile.py
@@ -19,6 +19,7 @@
import osgeo.ogr
import sys

from osgeo import gdal
from qgis.core import (
QgsApplication,
QgsSettings,
@@ -662,11 +663,13 @@ def testEncoding(self):
self.assertEqual(vl.dataProvider().encoding(), 'windows-1252')
self.assertEqual(next(vl.getFeatures())[1], 'äöü')

file_path = os.path.join(TEST_DATA_DIR, 'shapefile', 'windows-1252.zip')
vl = QgsVectorLayer('/vsizip/{}'.format(file_path))
self.assertTrue(vl.isValid())
self.assertEqual(vl.dataProvider().encoding(), 'windows-1252')
self.assertEqual(next(vl.getFeatures())[1], 'äöü')
if int(gdal.VersionInfo('VERSION_NUM')) >= GDAL_COMPUTE_VERSION(3, 1, 0):
# correct autodetection of vsizip based shapefiles depends on GDAL 3.1
file_path = os.path.join(TEST_DATA_DIR, 'shapefile', 'windows-1252.zip')
vl = QgsVectorLayer('/vsizip/{}'.format(file_path))
self.assertTrue(vl.isValid())
self.assertEqual(vl.dataProvider().encoding(), 'windows-1252')
self.assertEqual(next(vl.getFeatures())[1], 'äöü')

file_path = os.path.join(TEST_DATA_DIR, 'shapefile', 'system_encoding.shp')
vl = QgsVectorLayer(file_path)

0 comments on commit 50bdd36

Please sign in to comment.
You can’t perform that action at this time.