diff --git a/src/fileformats/ocd_georef_fields.cpp b/src/fileformats/ocd_georef_fields.cpp index 8077c10c9..96dbc490b 100644 --- a/src/fileformats/ocd_georef_fields.cpp +++ b/src/fileformats/ocd_georef_fields.cpp @@ -851,8 +851,8 @@ void OcdGeorefFields::setupGeoref(Georeferencing& georef, applyGridAndZone(georef, i, warning_handler); QPointF proj_ref_point(x, y); - georef.setProjectedRefPoint(proj_ref_point, false); - + georef.setProjectedRefPoint(proj_ref_point, false, false); + georef.setCombinedScaleFactor(1.0); georef.setGrivation(qIsFinite(a) ? a : 0); } diff --git a/src/fileformats/xml_file_format.cpp b/src/fileformats/xml_file_format.cpp index b8990a7c1..3fed5e457 100644 --- a/src/fileformats/xml_file_format.cpp +++ b/src/fileformats/xml_file_format.cpp @@ -593,7 +593,9 @@ bool XMLFileImporter::importImplementation() auto georef = map->getGeoreferencing(); auto ref_point = MapCoordF { georef.getMapRefPoint() }; auto new_projected = georef.toProjectedCoords(ref_point + offset_f); - georef.setProjectedRefPoint(new_projected, false); + georef.setProjectedRefPoint(new_projected, false, false); + georef.setCombinedScaleFactor(georef.getCombinedScaleFactor()); // keep combined scale factor + georef.setGrivation(georef.getGrivation()); // keep grivation, update declination map->setGeoreferencing(georef); } } diff --git a/src/gdal/ogr_file_format.cpp b/src/gdal/ogr_file_format.cpp index 21c6109e2..b582f7bc4 100644 --- a/src/gdal/ogr_file_format.cpp +++ b/src/gdal/ogr_file_format.cpp @@ -850,7 +850,9 @@ bool OgrFileImport::importImplementation() auto georef = map->getGeoreferencing(); auto ref_point = MapCoordF { georef.getMapRefPoint() }; auto new_projected = georef.toProjectedCoords(ref_point + offset_f); - georef.setProjectedRefPoint(new_projected, false); + georef.setProjectedRefPoint(new_projected, false, false); + georef.setCombinedScaleFactor(georef.getCombinedScaleFactor()); // keep combined scale factor + georef.setGrivation(georef.getGrivation()); // keep grivation, update declination map->setGeoreferencing(georef); } } @@ -970,7 +972,8 @@ ogr::unique_srs OgrFileImport::importGeoreferencing(OGRDataSourceH data_source) QString::fromLatin1("+proj=ortho +datum=WGS84 +ellps=WGS84 +units=m +lat_0=%1 +lon_0=%2 +no_defs") .arg(latitude, 0, 'f') .arg(longitude, 0, 'f') ); - ortho_georef.setProjectedRefPoint({}, false); + ortho_georef.setProjectedRefPoint({}, false, false); + ortho_georef.setCombinedScaleFactor(1.0); ortho_georef.setDeclination(map->getGeoreferencing().getDeclination()); map->setGeoreferencing(ortho_georef); return srsFromMap(); diff --git a/src/gdal/ogr_template.cpp b/src/gdal/ogr_template.cpp index a347c1278..6c34ae693 100644 --- a/src/gdal/ogr_template.cpp +++ b/src/gdal/ogr_template.cpp @@ -193,7 +193,9 @@ std::unique_ptr OgrTemplate::makeOrthographicGeoreferencing(cons georef->setProjectedCRS(QString{}, QString::fromLatin1("+proj=ortho +datum=WGS84 +ellps=WGS84 +units=m +lat_0=%1 +lon_0=%2 +no_defs") .arg(center.latitude()).arg(center.longitude())); - georef->setProjectedRefPoint({}, false); + georef->setProjectedRefPoint({}, false, false); + georef->setCombinedScaleFactor(1.0); + georef->setGrivation(0.0); } else { @@ -367,7 +369,9 @@ try explicit_georef = std::make_unique(); explicit_georef->setScaleDenominator(int(map_georef.getScaleDenominator())); explicit_georef->setProjectedCRS(QString{}, projected_crs_spec); - explicit_georef->setProjectedRefPoint({}, false); + explicit_georef->setProjectedRefPoint({}, false, false); + explicit_georef->setCombinedScaleFactor(1.0); + explicit_georef->setGrivation(0.0); } } } diff --git a/src/templates/template_image.cpp b/src/templates/template_image.cpp index e9ee9b138..cf4cd8157 100644 --- a/src/templates/template_image.cpp +++ b/src/templates/template_image.cpp @@ -235,6 +235,8 @@ bool TemplateImage::postLoadConfiguration(QWidget* dialog_parent, bool& out_cent calculateGeoreferencing(); auto const center_pixel = MapCoordF(0.5 * (image.width() - 1), 0.5 * (image.height() - 1)); initial_georef.setProjectedRefPoint(georef->toProjectedCoords(center_pixel)); + initial_georef.setCombinedScaleFactor(1.0); + initial_georef.setGrivation(0.0); } GeoreferencingDialog dialog(dialog_parent, map, &initial_georef, false); diff --git a/src/templates/template_track.cpp b/src/templates/template_track.cpp index 9a401e8bf..9313fc661 100644 --- a/src/templates/template_track.cpp +++ b/src/templates/template_track.cpp @@ -609,6 +609,8 @@ void TemplateTrack::applyProjectedCrsSpec() georef.setScaleDenominator(int(map->getScaleDenominator())); georef.setProjectedCRS(QString{}, projected_crs_spec); georef.setProjectedRefPoint({}); + georef.setCombinedScaleFactor(1.0); + georef.setGrivation(0.0); track.changeMapGeoreferencing(georef); } diff --git a/test/georef_ocd_mapping_t.cpp b/test/georef_ocd_mapping_t.cpp index 2bd42b04e..559601c60 100644 --- a/test/georef_ocd_mapping_t.cpp +++ b/test/georef_ocd_mapping_t.cpp @@ -266,7 +266,7 @@ private slots: } georef.setProjectedCRS(georef_result.crs_id, spec, crs_params); - georef.setProjectedRefPoint(georef_result.ref_point, false); + georef.setProjectedRefPoint(georef_result.ref_point, false, false); georef.setScaleDenominator(georef_result.scale); georef.setDeclination(georef_result.declination); georef.setGrivation(georef_result.grivation);