diff options
| -rw-r--r-- | src/iso19111/datum.cpp | 2 | ||||
| -rw-r--r-- | src/iso19111/io.cpp | 12 | ||||
| -rw-r--r-- | test/unit/gie_self_tests.cpp | 8 | ||||
| -rw-r--r-- | test/unit/test_io.cpp | 34 |
4 files changed, 38 insertions, 18 deletions
diff --git a/src/iso19111/datum.cpp b/src/iso19111/datum.cpp index 9d2e48a0..4df1b319 100644 --- a/src/iso19111/datum.cpp +++ b/src/iso19111/datum.cpp @@ -1126,7 +1126,7 @@ void GeodeticReferenceFrame::_exportToWKT( if (TOWGS84Params.size() == 7) { formatter->startNode(io::WKTConstants::TOWGS84, false); for (const auto &val : TOWGS84Params) { - formatter->add(val); + formatter->add(val, 12); } formatter->endNode(); } diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 65667ab0..3517c225 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -501,18 +501,6 @@ static inline std::string normalizeExponent(const std::string &in) { static inline std::string normalizeSerializedString(const std::string &in) { auto ret(normalizeExponent(in)); - auto dotPos = ret.find('.'); - // Detect sequences like x.yz000000foo - if( dotPos != std::string::npos && - ret.find('e', dotPos) == std::string::npos && - ret.find('E', dotPos) == std::string::npos ) - { - auto zeroesPos = ret.find("000000", dotPos); - if( zeroesPos != std::string::npos ) - { - ret.resize(zeroesPos); - } - } return ret; } diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp index 14bb2241..b77fecf3 100644 --- a/test/unit/gie_self_tests.cpp +++ b/test/unit/gie_self_tests.cpp @@ -697,11 +697,9 @@ TEST(gie, proj_create_crs_to_crs_PULKOVO42_ETRS89) { c.xyz.x = 45; // Lat c.xyz.y = 25; // Long c.xyz.z = 0; - proj_trans_generic (P, PJ_FWD, - &(c.xyz.x), sizeof(double), 1, - &(c.xyz.y), sizeof(double), 1, - &(c.xyz.z), sizeof(double), 1, - nullptr, 0, 0); + proj_trans_generic(P, PJ_FWD, &(c.xyz.x), sizeof(double), 1, &(c.xyz.y), + sizeof(double), 1, &(c.xyz.z), sizeof(double), 1, + nullptr, 0, 0); EXPECT_NEAR(c.xy.x, 44.999701238, 1e-9); EXPECT_NEAR(c.xy.y, 24.998474948, 1e-9); diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index b27fece7..1bbedc03 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -8927,3 +8927,37 @@ TEST(io, guessDialect) { EXPECT_EQ(WKTParser().guessDialect("foo"), WKTParser::WKTGuessedDialect::NOT_WKT); } + +// --------------------------------------------------------------------------- + +// GDAL MITAB driver requires on rather excessive precision on parameter +// values to implement a nasty trick... + +TEST(wkt_export, precision) { + auto wkt = "PROJCS[\"RGF93 / Lambert-93\",\n" + " GEOGCS[\"RGF93\",\n" + " DATUM[\"Reseau_Geodesique_Francais_1993\",\n" + " SPHEROID[\"GRS 80\",6378137,298.257222101],\n" + " AUTHORITY[\"EPSG\",\"6171\"]],\n" + " PRIMEM[\"Greenwich\",0],\n" + " UNIT[\"degree\",0.0174532925199433]],\n" + " PROJECTION[\"Lambert_Conformal_Conic_2SP\"],\n" + " PARAMETER[\"standard_parallel_1\",49.00000000001],\n" + " PARAMETER[\"standard_parallel_2\",44],\n" + " PARAMETER[\"latitude_of_origin\",46.5],\n" + " PARAMETER[\"central_meridian\",3],\n" + " PARAMETER[\"false_easting\",700000],\n" + " PARAMETER[\"false_northing\",6600000],\n" + " UNIT[\"Meter\",1],\n" + " AXIS[\"Easting\",EAST],\n" + " AXIS[\"Northing\",NORTH]]"; + + auto obj = WKTParser().createFromWKT(wkt); + auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj); + ASSERT_TRUE(crs != nullptr); + + EXPECT_EQ( + crs->exportToWKT( + WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get()), + wkt); +} |
