From dc55b17d0c7ae180bb73add3581fac7e8f959c11 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 30 Nov 2019 19:41:50 +0100 Subject: Database: register the BWTA2017.gsb grid (DHDN->ETRS89 for Baden-Wurtemberg) Relates to https://github.com/OSGeo/proj-datumgrid/pull/65 , https://github.com/OSGeo/proj-datumgrid/issues/22 As EPSG has no entry for it, we create a grid_transformation, as well as a dedicated area of use based on the extent of the grid, under the PROJ authority. With the hope to be able to remove it once EPSG has an entry... --- test/cli/testprojinfo | 4 ++++ test/cli/testprojinfo_out.dist | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'test') diff --git a/test/cli/testprojinfo b/test/cli/testprojinfo index 4ac21118..9d0ce52d 100755 --- a/test/cli/testprojinfo +++ b/test/cli/testprojinfo @@ -143,6 +143,10 @@ echo 'Testing -s "AGD66" -t "WGS 84 (G1762)" --spatial-test intersects --summary $EXE -s "AGD66" -t "WGS 84 (G1762)" --spatial-test intersects --summary >>${OUT} 2>&1 echo "" >>${OUT} +echo 'Testing -s EPSG:31467 -t ETRS89 --spatial-test intersects --grid-check none --bbox 8,48,9,49 --summary. Should include both DHDN to ETRS89 (8) and DHDN to ETRS89 (BWTA2017)' >> ${OUT} +$EXE -s EPSG:31467 -t ETRS89 --spatial-test intersects --grid-check none --bbox 8,48,9,49 --summary >>${OUT} 2>&1 +echo "" >>${OUT} + # do 'diff' with distribution results echo "diff ${OUT} with testprojinfo_out.dist" diff -u ${OUT} ${TEST_CLI_DIR}/testprojinfo_out.dist diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist index 0e11ea3f..8b17c0e7 100644 --- a/test/cli/testprojinfo_out.dist +++ b/test/cli/testprojinfo_out.dist @@ -1071,3 +1071,10 @@ unknown id, AGD66 to GDA2020 (1) + Conversion from GDA2020 (geog2D) to GDA2020 ( unknown id, AGD66 to WGS 84 (17) + WGS 84 to WGS 84 (G1762), 3 m, Australia - onshore unknown id, Ballpark geographic offset from AGD66 to WGS 84 (G1762), unknown accuracy, World, has ballpark transformation +Testing -s EPSG:31467 -t ETRS89 --spatial-test intersects --grid-check none --bbox 8,48,9,49 --summary. Should include both DHDN to ETRS89 (8) and DHDN to ETRS89 (BWTA2017) +Candidate operations found: 4 +unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (BWTA2017), 0.89 m, Germany - Baden-Wurtemberg +unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (8), 0.9 m, Germany - onshore +unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (3), 1 m, Germany - West Germany S +unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (2), 3 m, Germany - West Germany all states + -- cgit v1.2.3 From 5a7ff4380e9526aca0287e45b27a8b37664e9708 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 1 Dec 2019 00:16:15 +0100 Subject: Database: register AUSGeoid09 and AUSGeoid2020 Related to https://github.com/OSGeo/proj-datumgrid/pull/66 Tune operation search so that it can work with Geog2D <--> VertCS for commandline niceness --- test/cli/testprojinfo | 8 ++++++++ test/cli/testprojinfo_out.dist | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'test') diff --git a/test/cli/testprojinfo b/test/cli/testprojinfo index 9d0ce52d..4ce5e90c 100755 --- a/test/cli/testprojinfo +++ b/test/cli/testprojinfo @@ -147,6 +147,14 @@ echo 'Testing -s EPSG:31467 -t ETRS89 --spatial-test intersects --grid-check non $EXE -s EPSG:31467 -t ETRS89 --spatial-test intersects --grid-check none --bbox 8,48,9,49 --summary >>${OUT} 2>&1 echo "" >>${OUT} +echo 'Testing -s "GDA94" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects' >> ${OUT} +$EXE -s "GDA94" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects >>${OUT} 2>&1 +echo "" >>${OUT} + +echo 'Testing -s "GDA2020" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects' >> ${OUT} +$EXE -s "GDA2020" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects >>${OUT} 2>&1 +echo "" >>${OUT} + # do 'diff' with distribution results echo "diff ${OUT} with testprojinfo_out.dist" diff -u ${OUT} ${TEST_CLI_DIR}/testprojinfo_out.dist diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist index 8b17c0e7..25b29a79 100644 --- a/test/cli/testprojinfo_out.dist +++ b/test/cli/testprojinfo_out.dist @@ -1078,3 +1078,23 @@ unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (8), 0.9 m, unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (3), 1 m, Germany - West Germany S unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (2), 3 m, Germany - West Germany all states +Testing -s "GDA94" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects +Candidate operations found: 1 +------------------------------------- +Operation n°1: + +DERIVED_FROM(EPSG):5656, GDA94 to AHD height (49), 0.03 m, Australia - mainland + +PROJ string: ++proj=pipeline +step +inv +proj=vgridshift +grids=AUSGeoid09_V1.01.gtx +multiplier=1 + +Testing -s "GDA2020" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects +Candidate operations found: 1 +------------------------------------- +Operation n°1: + +DERIVED_FROM(EPSG):8451, GDA2020 to AHD height (1), 0.03 m, Australia Christmas and Cocos - onshore + +PROJ string: ++proj=pipeline +step +inv +proj=vgridshift +grids=AUSGeoid2020_20180201.gtx +multiplier=1 + -- cgit v1.2.3 From f3a9e54c09829cec51062ebb754545c79370ddfe Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 4 Dec 2019 21:49:17 +0100 Subject: proj_grid_info(): fix crash when passing a file that exists but is not a grid --- test/unit/gie_self_tests.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp index 15db814a..a738db75 100644 --- a/test/unit/gie_self_tests.cpp +++ b/test/unit/gie_self_tests.cpp @@ -386,6 +386,10 @@ TEST(gie, info_functions) { grid_info = proj_grid_info("nonexistinggrid"); ASSERT_EQ(std::string(grid_info.filename), ""); + // File exists, but is not a grid + grid_info = proj_grid_info("proj.db"); + ASSERT_EQ(std::string(grid_info.filename), ""); + /* proj_init_info() */ init_info = proj_init_info("unknowninit"); ASSERT_EQ(std::string(init_info.filename), ""); -- cgit v1.2.3 From 97bbfe32aacc361a5c34bcb2c5045c977d21de4b Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 5 Dec 2019 13:32:16 +0100 Subject: import from PROJ string CRS: better deal with strings that look like Google Mercator projection, but with subtlely different parameters (fixes https://github.com/OSGeo/gdal/issues/2087) --- test/unit/test_io.cpp | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 552eb5bf..38dfc2b4 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -8186,9 +8186,10 @@ TEST(io, projparse_merc_variant_B) { // --------------------------------------------------------------------------- TEST(io, projparse_merc_google_mercator) { - auto obj = PROJStringParser().createFromPROJString( + auto projString = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 " - "+k=1 +units=m +nadgrids=@null +type=crs"); + "+k=1 +units=m +nadgrids=@null +no_defs +type=crs"; + auto obj = PROJStringParser().createFromPROJString(projString); auto crs = nn_dynamic_pointer_cast(obj); ASSERT_TRUE(crs != nullptr); WKTFormatterNNPtr f(WKTFormatter::create()); @@ -8202,6 +8203,36 @@ TEST(io, projparse_merc_google_mercator) { EXPECT_TRUE(wkt.find("DATUM[\"World Geodetic System 1984\"") != std::string::npos) << wkt; + + EXPECT_EQ( + replaceAll(crs->exportToPROJString(PROJStringFormatter::create().get()), + " +wktext", ""), + projString); +} + +// --------------------------------------------------------------------------- + +TEST(io, projparse_merc_not_quite_google_mercator) { + auto projString = + "+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=10 +x_0=0 +y_0=0 " + "+k=1 +units=m +nadgrids=@null +no_defs +type=crs"; + auto obj = PROJStringParser().createFromPROJString(projString); + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + WKTFormatterNNPtr f(WKTFormatter::create()); + f->simulCurNodeHasId(); + f->setMultiLine(false); + crs->exportToWKT(f.get()); + auto wkt = f->toString(); + EXPECT_TRUE(wkt.find("METHOD[\"Popular Visualisation Pseudo " + "Mercator\",ID[\"EPSG\",1024]") != std::string::npos) + << wkt; + EXPECT_TRUE(wkt.find("DATUM[\"unknown\",") != std::string::npos) << wkt; + + EXPECT_EQ( + replaceAll(crs->exportToPROJString(PROJStringFormatter::create().get()), + " +wktext", ""), + projString); } // --------------------------------------------------------------------------- -- cgit v1.2.3 From 443ce39d0906a57c80086041c0f013fef21fa11a Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 5 Dec 2019 21:25:53 +0100 Subject: Update ntv2_out.dist and conditions to run it --- test/cli/Makefile.am | 2 +- test/cli/ntv2_out.dist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/cli/Makefile.am b/test/cli/Makefile.am index db47370c..758352c6 100644 --- a/test/cli/Makefile.am +++ b/test/cli/Makefile.am @@ -49,7 +49,7 @@ testign-check: fi testntv2-check: - @if [ -f $(PROJ_LIB)/ntv2_0.gsb ] ; then \ + @if [ -f $(PROJ_LIB)/ntv2_0.gsb -a -f $(PROJ_LIB)/conus -a -f $(PROJ_LIB)/ntv1_can.dat ] ; then \ PROJ_LIB=$(PROJ_LIB) $(TESTNTV2) $(CS2CSEXE) ; \ fi diff --git a/test/cli/ntv2_out.dist b/test/cli/ntv2_out.dist index 5ce26e6e..9a97f9cf 100644 --- a/test/cli/ntv2_out.dist +++ b/test/cli/ntv2_out.dist @@ -7,5 +7,5 @@ Point in the ONwinsor subgrid. ############################################################## Try with NTv2 and NTv1 together ... falls back to NTv1 99d00'00.000"W 65d00'00.000"N 0.0 99d0'1.5885"W 65d0'1.3482"N 0.000 -111d00'00.000"W 46d00'00.000"N 0.0 111d0'3.1549"W 45d59'59.7528"N 0.000 +111d00'00.000"W 46d00'00.000"N 0.0 111d0'3.1897"W 45d59'59.7489"N 0.000 111d00'00.000"W 47d30'00.000"N 0.0 111d0'2.7989"W 47d29'59.9896"N 0.000 -- cgit v1.2.3 From 5cc1095970127f8df5c4f636b1ce782829510fa0 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 9 Dec 2019 09:08:13 +0100 Subject: CRS identification: use case insensitive comparison for authority name (fixes #1779) --- test/unit/test_crs.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test') diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index 427fd741..e896853f 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -2281,6 +2281,38 @@ TEST(crs, projectedCRS_identify_db) { // --------------------------------------------------------------------------- +TEST(crs, projectedCRS_identify_wrong_auth_name_case) { + auto dbContext = DatabaseContext::create(); + auto factoryAnonymous = AuthorityFactory::create(dbContext, std::string()); + auto obj = + WKTParser() + .attachDatabaseContext(dbContext) + .setStrict(false) + .createFromWKT( + "PROJCS[\"World_Cylindrical_Equal_Area\"," + "GEOGCS[\"GCS_WGS_1984\"," + "DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\"," + "6378137.0,298.257223563]]," + "PRIMEM[\"Greenwich\",0.0]," + "UNIT[\"Degree\",0.0174532925199433]]," + "PROJECTION[\"Cylindrical_Equal_Area\"]," + "PARAMETER[\"False_Easting\",0.0]," + "PARAMETER[\"False_Northing\",0.0]," + "PARAMETER[\"Central_Meridian\",0.0]," + "PARAMETER[\"Standard_Parallel_1\",0.0],UNIT[\"Meter\",1.0]," + "AUTHORITY[\"Esri\",54034]]"); // should be ESRI all caps + auto crs = nn_dynamic_pointer_cast(obj); + ASSERT_TRUE(crs != nullptr); + auto res = crs->identify(factoryAnonymous); + ASSERT_EQ(res.size(), 1U); + const auto &ids = res.front().first->identifiers(); + ASSERT_EQ(ids.size(), 1U); + EXPECT_EQ(*(ids.front()->codeSpace()), "ESRI"); + EXPECT_EQ(ids.front()->code(), "54034"); +} + +// --------------------------------------------------------------------------- + TEST(crs, mercator_1SP_as_WKT1_ESRI) { auto obj = PROJStringParser().createFromPROJString( -- cgit v1.2.3 From 38de84f38bceed4030710648334729d96f7c2204 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 10 Dec 2019 23:51:03 +0100 Subject: Database: update to IGNF v3.1.0 --- test/unit/test_factory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/unit/test_factory.cpp b/test/unit/test_factory.cpp index 93b2ef34..0d47bfc3 100644 --- a/test/unit/test_factory.cpp +++ b/test/unit/test_factory.cpp @@ -2872,7 +2872,7 @@ TEST(factory, getMetadata) { EXPECT_EQ(ctxt->getMetadata("i_do_not_exist"), nullptr); const char *IGNF_VERSION = ctxt->getMetadata("IGNF.VERSION"); ASSERT_TRUE(IGNF_VERSION != nullptr); - EXPECT_EQ(std::string(IGNF_VERSION), "3.0.3"); + EXPECT_EQ(std::string(IGNF_VERSION), "3.1.0"); } // --------------------------------------------------------------------------- -- cgit v1.2.3 From 0b5fb1239f93e93971e28c95df6b039156c65ffb Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 11 Dec 2019 11:46:34 +0100 Subject: createOperations(): make filtering out of 'uninteresting' operations less aggressive (refs #1787) 'EPSG:1304, Indian 1975 to WGS 84 (2), 5.0 m, Thailand - onshore and Gulf of Thailand' was removed because considered useless w.r.t first result 'EPSG:1812, Indian 1975 to WGS 84 (4), 3.0 m, Thailand - onshore' However the name of the area of use is not completely the same, so might be worth keeping it. --- test/unit/test_operation.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test') diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index 9cde8822..9cf03555 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -4628,6 +4628,33 @@ TEST(operation, geogCRS_to_geogCRS_context_WGS84_G1674_to_WGS84_G1762) { // --------------------------------------------------------------------------- +TEST(operation, geogCRS_to_geogCRS_context_EPSG_4240_Indian1975_to_EPSG_4326) { + auto authFactory = + AuthorityFactory::create(DatabaseContext::create(), "EPSG"); + auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0); + ctxt->setSpatialCriterion( + CoordinateOperationContext::SpatialCriterion::PARTIAL_INTERSECTION); + + auto list = CoordinateOperationFactory::create()->createOperations( + authFactory->createCoordinateReferenceSystem("4240"), // Indian 1975 + authFactory->createCoordinateReferenceSystem("4326"), ctxt); + ASSERT_EQ(list.size(), 3U); + + // Indian 1975 to WGS 84 (4), 3.0 m, Thailand - onshore + EXPECT_EQ(list[0]->getEPSGCode(), 1812); + + // The following is the one we want to see. It has a lesser accuracy than + // the above one and the same bbox, but the name of its area of use is + // slightly different + // Indian 1975 to WGS 84 (2), 5.0 m, Thailand - onshore and Gulf of Thailand + EXPECT_EQ(list[1]->getEPSGCode(), 1304); + + // Indian 1975 to WGS 84 (3), 1.0 m, Thailand - Bongkot field + EXPECT_EQ(list[2]->getEPSGCode(), 1537); +} + +// --------------------------------------------------------------------------- + TEST(operation, vertCRS_to_geogCRS_context) { auto authFactory = AuthorityFactory::create(DatabaseContext::create(), "EPSG"); -- cgit v1.2.3