aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_operation.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-11-22 21:32:51 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-11-22 21:32:51 +0100
commitb9d50247190e7b9ecd849ab260eb45edca3236cb (patch)
tree1a82cbecf9a1d6e66b6f5f36a41cac6208bdb494 /test/unit/test_operation.cpp
parent85a4e9149152dd97463651496854f9ecbd720b84 (diff)
downloadPROJ-b9d50247190e7b9ecd849ab260eb45edca3236cb.tar.gz
PROJ-b9d50247190e7b9ecd849ab260eb45edca3236cb.zip
Fix transformation between geographic CRS that differ by axis order and units
Diffstat (limited to 'test/unit/test_operation.cpp')
-rw-r--r--test/unit/test_operation.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index e62eddf9..528aa6b8 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -1142,6 +1142,36 @@ TEST(operation, transformation_createTOWGS84) {
// ---------------------------------------------------------------------------
+TEST(operation, createAxisOrderReversal) {
+
+ auto latLongDeg = GeographicCRS::create(
+ PropertyMap(), GeodeticReferenceFrame::EPSG_6326,
+ EllipsoidalCS::createLatitudeLongitude(UnitOfMeasure::DEGREE));
+ auto longLatDeg = GeographicCRS::create(
+ PropertyMap(), GeodeticReferenceFrame::EPSG_6326,
+ EllipsoidalCS::createLongitudeLatitude(UnitOfMeasure::DEGREE));
+ {
+ auto op = CoordinateOperationFactory::create()->createOperation(
+ latLongDeg, longLatDeg);
+ ASSERT_TRUE(op != nullptr);
+ EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=axisswap +order=2,1");
+ }
+ {
+ auto longLatRad = GeographicCRS::create(
+ PropertyMap(), GeodeticReferenceFrame::EPSG_6326,
+ EllipsoidalCS::createLongitudeLatitude(UnitOfMeasure::RADIAN));
+ auto op = CoordinateOperationFactory::create()->createOperation(
+ longLatRad, latLongDeg);
+ ASSERT_TRUE(op != nullptr);
+ EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline +step +proj=axisswap +order=2,1 "
+ "+step +proj=unitconvert +xy_in=rad +xy_out=deg");
+ }
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, utm_export) {
auto conv = Conversion::createUTM(PropertyMap(), 1, false);
EXPECT_EQ(conv->exportToPROJString(PROJStringFormatter::create().get()),