Skip to content
Permalink
Browse files

Merge pull request #8143 from mdouchin/patch-1

Processing - Add GeoPackage support in alg qgis:convertformat
  • Loading branch information
rldhont committed Oct 24, 2018
2 parents 72a7606 + 1cdac2c commit 5f26d1b0f9645bbc85f05a9b4f4331c9c5aafdbc
@@ -62,6 +62,7 @@
'ODS',
'XLSX',
'PDF',
'GPKG'
]

EXTS = [
@@ -87,6 +88,7 @@
'.ods',
'.xlsx',
'.pdf',
'.gpkg'
]


@@ -127,7 +129,7 @@ def getConsoleCommands(self):
output = ogrConnectionString(outFile)
options = unicode(self.getParameterValue(self.OPTIONS))

if outFormat == 'SQLite' and os.path.isfile(output):
if outFormat in ('SQLite', 'GPKG') and os.path.isfile(output):
os.remove(output)

arguments = []
@@ -27,15 +27,18 @@

import AlgorithmsTestBase
from processing.algs.gdal.ogr2ogrtopostgis import Ogr2OgrToPostGis
from processing.algs.gdal.ogr2ogr import Ogr2Ogr

import nose2
import shutil

import os
from qgis.testing import (
start_app,
unittest
)

testDataPath = os.path.join(os.path.dirname(__file__), 'testdata')


class TestGdalAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsTest):

@@ -54,6 +57,29 @@ def tearDownClass(cls):
def test_definition_file(self):
return 'gdal_algorithm_tests.yaml'

def testOgr2Ogr(self):
source = os.path.join(testDataPath, 'polys.gml')

alg = Ogr2Ogr()
alg.setParameterValue('INPUT_LAYER', source)
alg.setParameterValue('FORMAT', 0)
alg.setOutputValue('OUTPUT_LAYER', 'd:/temp/check.shp')
self.assertEqual(
alg.getConsoleCommands(),
['ogr2ogr',
'-f "ESRI Shapefile" "d:/temp/check.shp" ' +
source + ' polys2'])

alg = Ogr2Ogr()
alg.setParameterValue('INPUT_LAYER', source)
alg.setParameterValue('FORMAT', 22)
alg.setOutputValue('OUTPUT_LAYER', 'd:/temp/check.gpkg')
self.assertEqual(
alg.getConsoleCommands(),
['ogr2ogr',
'-f GPKG "d:/temp/check.gpkg" ' +
source + ' polys2'])


class TestGdalOgr2OgrToPostgis(unittest.TestCase):

0 comments on commit 5f26d1b

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