aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_crs.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-12-06 19:40:13 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-12-06 19:40:13 +0100
commit4022e2093a6773458c2453e42089c987da6efbf9 (patch)
tree805c39dc52d4738229f926efe0447c45134daf01 /test/unit/test_crs.cpp
parent6afbfc737384a4f58f2d5f8bc3bde69dacf9b355 (diff)
downloadPROJ-4022e2093a6773458c2453e42089c987da6efbf9.tar.gz
PROJ-4022e2093a6773458c2453e42089c987da6efbf9.zip
Fix special handling of Azimuth parameter of Krovak
Diffstat (limited to 'test/unit/test_crs.cpp')
-rw-r--r--test/unit/test_crs.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp
index 207aa7fb..15708606 100644
--- a/test/unit/test_crs.cpp
+++ b/test/unit/test_crs.cpp
@@ -1799,6 +1799,38 @@ TEST(crs, projectedCRS_as_PROJ_string) {
// ---------------------------------------------------------------------------
+TEST(crs, projectedCRS_Krovak_EPSG_5221_as_PROJ_string) {
+ auto factory = AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto crs = factory->createProjectedCRS("5221");
+ // 30deg 17' 17.30311'' = 30.28813975277777776
+ EXPECT_EQ(crs->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline +step +proj=axisswap +order=2,1 "
+ "+step +proj=unitconvert +xy_in=deg +xy_out=rad "
+ "+step +inv +proj=longlat +ellps=bessel +pm=ferro "
+ "+step +proj=krovak +lat_0=49.5 +lon_0=42.5 "
+ "+alpha=30.2881397527778 +k=0.9999 +x_0=0 +y_0=0 "
+ "+ellps=bessel +pm=ferro");
+}
+
+// ---------------------------------------------------------------------------
+
+TEST(crs, projectedCRS_Krovak_with_approximate_alpha_as_PROJ_string) {
+ // 30deg 17' 17.303'' = 30.288139722222223 as used in GDAL WKT1
+ auto obj = PROJStringParser().createFromPROJString(
+ "+proj=krovak +lat_0=49.5 +lon_0=42.5 +alpha=30.28813972222222 "
+ "+k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +pm=ferro +units=m +no_defs");
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
+ EXPECT_EQ(crs->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=pipeline "
+ "+step +proj=unitconvert +xy_in=deg +xy_out=rad "
+ "+step +inv +proj=longlat +ellps=bessel +pm=ferro "
+ "+step +proj=krovak +lat_0=49.5 +lon_0=42.5 "
+ "+alpha=30.2881397222222 +k=0.9999 +x_0=0 +y_0=0 "
+ "+ellps=bessel +pm=ferro");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(crs, projectedCRS_identify_no_db) {
{
// Hard-coded case: WGS 84 / UTM. No name
@@ -2455,7 +2487,7 @@ TEST(crs, Krovak_North_Orientated_as_WKT1_ESRI) {
"PARAMETER[\"False_Northing\",0.0],"
"PARAMETER[\"Pseudo_Standard_Parallel_1\",78.5],"
"PARAMETER[\"Scale_Factor\",1.0],"
- "PARAMETER[\"Azimuth\",30.2881397222222],"
+ "PARAMETER[\"Azimuth\",30.2881397527778],"
"PARAMETER[\"Longitude_Of_Center\",0.0],"
"PARAMETER[\"Latitude_Of_Center\",0.0],"
"PARAMETER[\"X_Scale\",-1.0],"
@@ -2487,7 +2519,7 @@ TEST(crs, Krovak_as_WKT1_ESRI) {
"PARAMETER[\"False_Northing\",0.0],"
"PARAMETER[\"Pseudo_Standard_Parallel_1\",78.5],"
"PARAMETER[\"Scale_Factor\",1.0],"
- "PARAMETER[\"Azimuth\",30.2881397222222],"
+ "PARAMETER[\"Azimuth\",30.2881397527778],"
"PARAMETER[\"Longitude_Of_Center\",0.0],"
"PARAMETER[\"Latitude_Of_Center\",0.0],"
"PARAMETER[\"X_Scale\",1.0],"