@@ -1225,55 +1225,52 @@ def testGdalTindex(self):
1225
1225
alg .initAlgorithm ()
1226
1226
1227
1227
with tempfile .TemporaryDirectory () as outdir :
1228
- self .assertEqual (
1229
- alg .getConsoleCommands ({'LAYERS' : [source ],
1230
- 'OUTPUT' : outdir + '/test.shp' }, context , feedback ),
1231
- ['gdaltindex' ,
1232
- '-tileindex location -f "ESRI Shapefile" ' +
1233
- outdir + '/test.shp ' +
1234
- source ])
1228
+ commands = alg .getConsoleCommands ({'LAYERS' : [source ],
1229
+ 'OUTPUT' : outdir + '/test.shp' }, context , feedback )
1230
+ self .assertEqual (len (commands ), 2 )
1231
+ self .assertEqual (commands [0 ], 'gdaltindex' )
1232
+ self .assertIn ('-tileindex location -f "ESRI Shapefile" ' + outdir + '/test.shp' , commands [1 ])
1233
+ self .assertIn ('--optfile ' , commands [1 ])
1235
1234
1236
1235
# with input srs
1237
- self .assertEqual (
1238
- alg .getConsoleCommands ({'LAYERS' : [source ],
1239
- 'TARGET_CRS' : 'EPSG:3111' ,
1240
- 'OUTPUT' : outdir + '/test.shp' }, context , feedback ),
1241
- ['gdaltindex' ,
1242
- '-tileindex location -t_srs EPSG:3111 -f "ESRI Shapefile" ' +
1243
- outdir + '/test.shp ' +
1244
- source ])
1236
+ commands = alg .getConsoleCommands ({'LAYERS' : [source ],
1237
+ 'TARGET_CRS' : 'EPSG:3111' ,
1238
+ 'OUTPUT' : outdir + '/test.shp' }, context , feedback )
1239
+ self .assertEqual (len (commands ), 2 )
1240
+ self .assertEqual (commands [0 ], 'gdaltindex' )
1241
+ self .assertIn ('-tileindex location -t_srs EPSG:3111 -f "ESRI Shapefile" ' + outdir + '/test.shp' , commands [1 ])
1242
+ self .assertIn ('--optfile ' , commands [1 ])
1245
1243
1246
1244
# with target using proj string
1247
1245
custom_crs = 'proj4: +proj=utm +zone=36 +south +a=6378249.145 +b=6356514.966398753 +towgs84=-143,-90,-294,0,0,0,0 +units=m +no_defs'
1248
- self .assertEqual (
1249
- alg .getConsoleCommands ({'LAYERS' : [source ],
1250
- 'TARGET_CRS' : custom_crs ,
1251
- 'OUTPUT' : outdir + '/test.shp' }, context , feedback ),
1252
- ['gdaltindex' ,
1253
- '-tileindex location -t_srs EPSG:20936 -f "ESRI Shapefile" ' +
1254
- outdir + '/test.shp ' +
1255
- source ])
1246
+ commands = alg .getConsoleCommands ({'LAYERS' : [source ],
1247
+ 'TARGET_CRS' : custom_crs ,
1248
+ 'OUTPUT' : outdir + '/test.shp' }, context , feedback )
1249
+ self .assertEqual (len (commands ), 2 )
1250
+ self .assertEqual (commands [0 ], 'gdaltindex' )
1251
+ self .assertIn ('-tileindex location -t_srs EPSG:20936 -f "ESRI Shapefile" ' + outdir + '/test.shp' , commands [1 ])
1252
+ self .assertIn ('--optfile ' , commands [1 ])
1256
1253
1257
1254
# with target using custom projection
1258
1255
custom_crs = 'proj4: +proj=utm +zone=36 +south +a=63785 +b=6357 +towgs84=-143,-90,-294,0,0,0,0 +units=m +no_defs'
1259
- self .assertEqual (
1260
- alg .getConsoleCommands ({'LAYERS' : [source ],
1261
- 'TARGET_CRS' : custom_crs ,
1262
- 'OUTPUT' : outdir + '/test.shp' }, context , feedback ),
1263
- ['gdaltindex' ,
1264
- '-tileindex location -t_srs "+proj=utm +zone=36 +south +a=63785 +b=6357 +towgs84=-143,-90,-294,0,0,0,0 +units=m +no_defs" -f "ESRI Shapefile" ' +
1265
- outdir + '/test.shp ' +
1266
- source ])
1256
+ commands = alg .getConsoleCommands ({'LAYERS' : [source ],
1257
+ 'TARGET_CRS' : custom_crs ,
1258
+ 'OUTPUT' : outdir + '/test.shp' }, context , feedback )
1259
+ self .assertEqual (len (commands ), 2 )
1260
+ self .assertEqual (commands [0 ], 'gdaltindex' )
1261
+ self .assertIn ('-tileindex location -t_srs "+proj=utm +zone=36 +south +a=63785 +b=6357 +towgs84=-143,-90,-294,0,0,0,0 +units=m +no_defs" -f "ESRI Shapefile" ' + outdir + '/test.shp' , commands [1 ])
1262
+ self .assertIn ('--optfile ' , commands [1 ])
1267
1263
1268
1264
# with non-EPSG crs code
1269
- self .assertEqual (
1270
- alg .getConsoleCommands ({'LAYERS' : [source ],
1271
- 'TARGET_CRS' : 'POSTGIS:3111' ,
1272
- 'OUTPUT' : outdir + '/test.shp' }, context , feedback ),
1273
- ['gdaltindex' ,
1274
- '-tileindex location -t_srs EPSG:3111 -f "ESRI Shapefile" ' +
1275
- outdir + '/test.shp ' +
1276
- source ])
1265
+ commands = alg .getConsoleCommands ({'LAYERS' : [source ],
1266
+ 'TARGET_CRS' : 'POSTGIS:3111' ,
1267
+ 'OUTPUT' : outdir + '/test.shp' }, context , feedback )
1268
+ self .assertEqual (len (commands ), 2 )
1269
+ self .assertEqual (commands [0 ], 'gdaltindex' )
1270
+ self .assertIn (
1271
+ '-tileindex location -t_srs EPSG:3111 -f "ESRI Shapefile" ' + outdir + '/test.shp' ,
1272
+ commands [1 ])
1273
+ self .assertIn ('--optfile ' , commands [1 ])
1277
1274
1278
1275
def testGridAverage (self ):
1279
1276
context = QgsProcessingContext ()
0 commit comments