diff options
| -rw-r--r-- | src/iso19111/io.cpp | 3 | ||||
| -rw-r--r-- | test/unit/test_io.cpp | 3 | ||||
| -rw-r--r-- | test/unit/test_operation.cpp | 6 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 51fda1c1..360d55a2 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -6091,6 +6091,9 @@ static UnitOfMeasure _buildUnit(const LinearUnitDesc *unitsMatch) { static UnitOfMeasure _buildUnit(double to_meter_value) { // TODO: look-up in EPSG catalog + if (to_meter_value == 0) { + throw ParsingException("invalid unit value"); + } return UnitOfMeasure("unknown", to_meter_value, UnitOfMeasure::Type::LINEAR); } diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index edf987ba..30e0b427 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -7334,7 +7334,8 @@ TEST(io, projparse_longlat_axis_neu) { auto op = CoordinateOperationFactory::create()->createOperation( GeographicCRS::EPSG_4326, NN_NO_CHECK(crs)); ASSERT_TRUE(op != nullptr); - EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), "+proj=noop"); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=noop"); } // --------------------------------------------------------------------------- diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index c4cafef6..08a3f6ad 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -4504,7 +4504,8 @@ TEST(operation, geogCRS_to_geogCRS_noop) { GeographicCRS::EPSG_4326, GeographicCRS::EPSG_4326); ASSERT_TRUE(op != nullptr); EXPECT_EQ(op->nameStr(), "Null geographic offset from WGS 84 to WGS 84"); - EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), "+proj=noop"); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=noop"); EXPECT_EQ(op->inverse()->nameStr(), op->nameStr()); } @@ -4845,7 +4846,8 @@ TEST(operation, geocentricCRS_to_geocentricCRS_noop) { ASSERT_TRUE(op != nullptr); EXPECT_EQ(op->nameStr(), "Ballpark geocentric translation from WGS 84 to WGS 84"); - EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), "+proj=noop"); + EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()), + "+proj=noop"); EXPECT_EQ(op->inverse()->nameStr(), op->nameStr()); } |
