aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-11-04 14:58:24 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-11-04 14:58:24 +0100
commitc975c6d13f5c0c13c57834c15ecd265a9d91a705 (patch)
tree556baa55635a44b21e83366d9e92254f3cce0b23 /test
parentcff22050faa67017eb4c5b44cb383b265c07d156 (diff)
parent90c1166e316cc95296cd6db3ab1fc81243310de6 (diff)
downloadPROJ-c975c6d13f5c0c13c57834c15ecd265a9d91a705.tar.gz
PROJ-c975c6d13f5c0c13c57834c15ecd265a9d91a705.zip
Merge remote-tracking branch 'origin/master' into geoid_model
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_c_api.cpp6
-rw-r--r--test/unit/test_io.cpp34
-rw-r--r--test/unit/test_operation.cpp43
3 files changed, 81 insertions, 2 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp
index cb59563e..bdadc8b8 100644
--- a/test/unit/test_c_api.cpp
+++ b/test/unit/test_c_api.cpp
@@ -231,7 +231,8 @@ TEST_F(CApi, proj_create_from_wkt) {
" PRIMEM[\"Greenwich\",0],\n"
" UNIT[\"degree\",0.0174532925199433]]",
nullptr, nullptr, nullptr);
- EXPECT_EQ(obj, nullptr);
+ ObjectKeeper keeper(obj);
+ EXPECT_NE(obj, nullptr);
}
{
PROJ_STRING_LIST warningList = nullptr;
@@ -244,7 +245,8 @@ TEST_F(CApi, proj_create_from_wkt) {
" PRIMEM[\"Greenwich\",0],\n"
" UNIT[\"degree\",0.0174532925199433]]",
nullptr, &warningList, &errorList);
- EXPECT_EQ(obj, nullptr);
+ ObjectKeeper keeper(obj);
+ EXPECT_NE(obj, nullptr);
EXPECT_EQ(warningList, nullptr);
proj_string_list_destroy(warningList);
EXPECT_NE(errorList, nullptr);
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index 79851695..a71b63bb 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -1174,6 +1174,40 @@ TEST(wkt_parse, wkt1_Mercator_1SP_with_latitude_origin_0) {
// ---------------------------------------------------------------------------
+TEST(wkt_parse, wkt1_Mercator_1SP_without_scale_factor) {
+ // See https://github.com/OSGeo/PROJ/issues/1700
+ auto wkt = "PROJCS[\"unnamed\",\n"
+ " GEOGCS[\"WGS 84\",\n"
+ " DATUM[\"unknown\",\n"
+ " SPHEROID[\"WGS84\",6378137,298.257223563]],\n"
+ " PRIMEM[\"Greenwich\",0],\n"
+ " UNIT[\"degree\",0.0174532925199433]],\n"
+ " PROJECTION[\"Mercator_1SP\"],\n"
+ " PARAMETER[\"central_meridian\",0],\n"
+ " PARAMETER[\"false_easting\",0],\n"
+ " PARAMETER[\"false_northing\",0],\n"
+ " UNIT[\"Meter\",1],\n"
+ " AXIS[\"Easting\",EAST],\n"
+ " AXIS[\"Northing\",NORTH]]";
+ WKTParser parser;
+ parser.setStrict(false).attachDatabaseContext(DatabaseContext::create());
+ auto obj = parser.createFromWKT(wkt);
+ EXPECT_TRUE(!parser.warningList().empty());
+
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ auto got_wkt = crs->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_GDAL).get());
+ EXPECT_TRUE(got_wkt.find("PARAMETER[\"scale_factor\",1]") !=
+ std::string::npos)
+ << got_wkt;
+ EXPECT_EQ(crs->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +units=m "
+ "+no_defs +type=crs");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(wkt_parse, wkt1_krovak_south_west) {
auto wkt =
"PROJCS[\"S-JTSK / Krovak\","
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index 328a04cc..07b0daea 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -5523,6 +5523,49 @@ TEST(operation, projCRS_no_id_to_geogCRS_context) {
// ---------------------------------------------------------------------------
+TEST(operation, geogCRS_3D_to_projCRS_with_2D_geocentric_translation) {
+
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
+ auto src =
+ authFactory->createCoordinateReferenceSystem("4979"); // WGS 84 3D
+
+ // Azores Central 1948 / UTM zone 26N
+ auto dst = authFactory->createCoordinateReferenceSystem("2189");
+
+ auto list =
+ CoordinateOperationFactory::create()->createOperations(src, dst, ctxt);
+ ASSERT_GE(list.size(), 1U);
+ EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline "
+ "+step +proj=axisswap +order=2,1 "
+ "+step +proj=unitconvert +xy_in=deg +z_in=m +xy_out=rad +z_out=m "
+ "+step +proj=push +v_3 " // this is what we check
+ "+step +proj=cart +ellps=WGS84 "
+ "+step +proj=helmert +x=104 +y=-167 +z=38 "
+ "+step +inv +proj=cart +ellps=intl "
+ "+step +proj=pop +v_3 " // this is what we check
+ "+step +proj=utm +zone=26 +ellps=intl");
+
+ auto listReverse =
+ CoordinateOperationFactory::create()->createOperations(dst, src, ctxt);
+ ASSERT_GE(listReverse.size(), 1U);
+ EXPECT_EQ(
+ listReverse[0]->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline "
+ "+step +inv +proj=utm +zone=26 +ellps=intl "
+ "+step +proj=push +v_3 " // this is what we check
+ "+step +proj=cart +ellps=intl "
+ "+step +proj=helmert +x=-104 +y=167 +z=-38 "
+ "+step +inv +proj=cart +ellps=WGS84 "
+ "+step +proj=pop +v_3 " // this is what we check
+ "+step +proj=unitconvert +xy_in=rad +z_in=m +xy_out=deg +z_out=m "
+ "+step +proj=axisswap +order=2,1");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, projCRS_to_projCRS) {
auto op = CoordinateOperationFactory::create()->createOperation(