@@ -653,6 +653,9 @@ def testBuildVrt(self):
653
653
self .assertIn ('-resolution average' , commands [1 ])
654
654
self .assertIn ('-separate' , commands [1 ])
655
655
self .assertNotIn ('-allow_projection_difference' , commands [1 ])
656
+ self .assertNotIn ('-add_alpha' , commands [1 ])
657
+ self .assertNotIn ('-a_srs' , commands [1 ])
658
+ self .assertIn ('-r nearest' , commands [1 ])
656
659
self .assertIn ('-input_file_list' , commands [1 ])
657
660
self .assertIn ('d:/temp/test.vrt' , commands [1 ])
658
661
@@ -664,6 +667,9 @@ def testBuildVrt(self):
664
667
self .assertIn ('-resolution lowest' , commands [1 ])
665
668
self .assertIn ('-separate' , commands [1 ])
666
669
self .assertNotIn ('-allow_projection_difference' , commands [1 ])
670
+ self .assertNotIn ('-add_alpha' , commands [1 ])
671
+ self .assertNotIn ('-a_srs' , commands [1 ])
672
+ self .assertIn ('-r nearest' , commands [1 ])
667
673
self .assertIn ('-input_file_list' , commands [1 ])
668
674
self .assertIn ('d:/temp/test.vrt' , commands [1 ])
669
675
@@ -675,6 +681,9 @@ def testBuildVrt(self):
675
681
self .assertIn ('-resolution average' , commands [1 ])
676
682
self .assertNotIn ('-allow_projection_difference' , commands [1 ])
677
683
self .assertNotIn ('-separate' , commands [1 ])
684
+ self .assertNotIn ('-add_alpha' , commands [1 ])
685
+ self .assertNotIn ('-a_srs' , commands [1 ])
686
+ self .assertIn ('-r nearest' , commands [1 ])
678
687
self .assertIn ('-input_file_list' , commands [1 ])
679
688
self .assertIn ('d:/temp/test.vrt' , commands [1 ])
680
689
@@ -686,6 +695,66 @@ def testBuildVrt(self):
686
695
self .assertIn ('-resolution average' , commands [1 ])
687
696
self .assertIn ('-allow_projection_difference' , commands [1 ])
688
697
self .assertIn ('-separate' , commands [1 ])
698
+ self .assertNotIn ('-add_alpha' , commands [1 ])
699
+ self .assertNotIn ('-a_srs' , commands [1 ])
700
+ self .assertIn ('-r nearest' , commands [1 ])
701
+ self .assertIn ('-input_file_list' , commands [1 ])
702
+ self .assertIn ('d:/temp/test.vrt' , commands [1 ])
703
+
704
+ commands = alg .getConsoleCommands ({'LAYERS' : [source ],
705
+ 'ADD_ALPHA' : True ,
706
+ 'OUTPUT' : 'd:/temp/test.vrt' }, context , feedback )
707
+ self .assertEqual (len (commands ), 2 )
708
+ self .assertEqual (commands [0 ], 'gdalbuildvrt' )
709
+ self .assertIn ('-resolution average' , commands [1 ])
710
+ self .assertIn ('-separate' , commands [1 ])
711
+ self .assertNotIn ('-allow_projection_difference' , commands [1 ])
712
+ self .assertNotIn ('-add_alpha' , commands [1 ])
713
+ self .assertNotIn ('-a_srs' , commands [1 ])
714
+ self .assertIn ('-r nearest' , commands [1 ])
715
+ self .assertIn ('-input_file_list' , commands [1 ])
716
+ self .assertIn ('d:/temp/test.vrt' , commands [1 ])
717
+
718
+ commands = alg .getConsoleCommands ({'LAYERS' : [source ],
719
+ 'ASSIGN_CRS' : 'EPSG:3111' ,
720
+ 'OUTPUT' : 'd:/temp/test.vrt' }, context , feedback )
721
+ self .assertEqual (len (commands ), 2 )
722
+ self .assertEqual (commands [0 ], 'gdalbuildvrt' )
723
+ self .assertIn ('-resolution average' , commands [1 ])
724
+ self .assertIn ('-separate' , commands [1 ])
725
+ self .assertNotIn ('-allow_projection_difference' , commands [1 ])
726
+ self .assertNotIn ('-add_alpha' , commands [1 ])
727
+ self .assertIn ('-a_srs EPSG:3111' , commands [1 ])
728
+ self .assertIn ('-r nearest' , commands [1 ])
729
+ self .assertIn ('-input_file_list' , commands [1 ])
730
+ self .assertIn ('d:/temp/test.vrt' , commands [1 ])
731
+
732
+ 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'
733
+ commands = alg .getConsoleCommands ({'LAYERS' : [source ],
734
+ 'ASSIGN_CRS' : custom_crs ,
735
+ 'OUTPUT' : 'd:/temp/test.vrt' }, context , feedback )
736
+ self .assertEqual (len (commands ), 2 )
737
+ self .assertEqual (commands [0 ], 'gdalbuildvrt' )
738
+ self .assertIn ('-resolution average' , commands [1 ])
739
+ self .assertIn ('-separate' , commands [1 ])
740
+ self .assertNotIn ('-allow_projection_difference' , commands [1 ])
741
+ self .assertNotIn ('-add_alpha' , commands [1 ])
742
+ self .assertIn ('-a_srs EPSG:20936' , commands [1 ])
743
+ self .assertIn ('-r nearest' , commands [1 ])
744
+ self .assertIn ('-input_file_list' , commands [1 ])
745
+ self .assertIn ('d:/temp/test.vrt' , commands [1 ])
746
+
747
+ commands = alg .getConsoleCommands ({'LAYERS' : [source ],
748
+ 'RESAMPLING' : 4 ,
749
+ 'OUTPUT' : 'd:/temp/test.vrt' }, context , feedback )
750
+ self .assertEqual (len (commands ), 2 )
751
+ self .assertEqual (commands [0 ], 'gdalbuildvrt' )
752
+ self .assertIn ('-resolution average' , commands [1 ])
753
+ self .assertIn ('-separate' , commands [1 ])
754
+ self .assertNotIn ('-allow_projection_difference' , commands [1 ])
755
+ self .assertNotIn ('-add_alpha' , commands [1 ])
756
+ self .assertNotIn ('-a_srs' , commands [1 ])
757
+ self .assertIn ('-r lanczos' , commands [1 ])
689
758
self .assertIn ('-input_file_list' , commands [1 ])
690
759
self .assertIn ('d:/temp/test.vrt' , commands [1 ])
691
760
0 commit comments