@@ -848,17 +848,32 @@ void TestQgsGeoreferencer::testGdalCommands()
848
848
QgsGeoreferencerMainWindow window;
849
849
window.openLayer ( QgsMapLayerType::RasterLayer, QStringLiteral ( TEST_DATA_DIR ) + QStringLiteral ( " /landsat.tif" ) );
850
850
851
- window.addPoint ( QgsPointXY ( 783414 , 3350122 ), QgsPointXY ( 783414 , 3350122 ), QgsCoordinateReferenceSystem () );
851
+ window.addPoint ( QgsPointXY ( 783414 , 3350122 ), QgsPointXY ( 783414.001234567 , 3350122.002345678 ), QgsCoordinateReferenceSystem () );
852
852
window.addPoint ( QgsPointXY ( 791344 , 3349795 ), QgsPointXY ( 791344 , 33497952 ), QgsCoordinateReferenceSystem () );
853
853
window.addPoint ( QgsPointXY ( 783077 , 334093 ), QgsPointXY ( 783077 , 334093 ), QgsCoordinateReferenceSystem () );
854
854
window.addPoint ( QgsPointXY ( 791134 , 3341401 ), QgsPointXY ( 791134 , 3341401 ), QgsCoordinateReferenceSystem () );
855
855
856
856
QString command = window.generateGDALtranslateCommand ();
857
857
// gdal_translate command must use source pixels, not geographic coordinates
858
- QCOMPARE ( command, QStringLiteral ( " gdal_translate -of GTiff -co TFW=YES -gcp 30.7303 14.0548 783414 3.35012e+06 -gcp 169.853 19.7917 791344 3.3498e+07 -gcp 24.818 52926.8 783077 334093 -gcp 166.169 167.055 791134 3.3414e+06 \" %1\" \" %2\" " ).arg (
858
+ QCOMPARE ( command, QStringLiteral ( " gdal_translate -of GTiff -co TFW=YES -gcp 30.73 14.055 783414.001 3350122.002 -gcp 169.853 19.792 791344 33497952 -gcp 24.818 52926.844 783077 334093 -gcp 166.169 167.055 791134 3341401 \" %1\" \" %2\" " ).arg (
859
859
QStringLiteral ( TEST_DATA_DIR ) + QStringLiteral ( " /landsat.tif" ),
860
860
QDir::tempPath () + QStringLiteral ( " /landsat.tif" ) ) );
861
861
862
+ command = window.generateGDALogr2ogrCommand ();
863
+ QCOMPARE ( command, QStringLiteral ( " ogr2ogr -gcp 783414 3350122 783414.001 3350122.002 -gcp 791344 3349795 791344 33497952 -gcp 783077 334093 783077 334093 -gcp 791134 3341401 791134 3341401 -tps -t_srs EPSG:32633 \"\" \" %1\" " ).arg (
864
+ QStringLiteral ( TEST_DATA_DIR ) + QStringLiteral ( " /landsat.tif" ) ) );
865
+
866
+ window.mTargetCrs = QgsCoordinateReferenceSystem ( QStringLiteral ( " EPSG:4326" ) );
867
+ command = window.generateGDALtranslateCommand ();
868
+ QgsDebugMsg ( command );
869
+ QCOMPARE ( command, QStringLiteral ( " gdal_translate -of GTiff -co TFW=YES -gcp 30.73 14.055 783414.00123457 3350122.00234568 -gcp 169.853 19.792 791344 33497952 -gcp 24.818 52926.844 783077 334093 -gcp 166.169 167.055 791134 3341401 \" %1\" \" %2\" " ).arg (
870
+ QStringLiteral ( TEST_DATA_DIR ) + QStringLiteral ( " /landsat.tif" ),
871
+ QDir::tempPath () + QStringLiteral ( " /landsat.tif" ) ) );
872
+
873
+ command = window.generateGDALogr2ogrCommand ();
874
+ QgsDebugMsg ( command );
875
+ QCOMPARE ( command, QStringLiteral ( " ogr2ogr -gcp 783414 3350122 783414.00123457 3350122.00234568 -gcp 791344 3349795 791344 33497952 -gcp 783077 334093 783077 334093 -gcp 791134 3341401 791134 3341401 -tps -t_srs EPSG:4326 \"\" \" %1\" " ).arg (
876
+ QStringLiteral ( TEST_DATA_DIR ) + QStringLiteral ( " /landsat.tif" ) ) );
862
877
}
863
878
864
879
QGSTEST_MAIN ( TestQgsGeoreferencer )
0 commit comments